Ooad Unit-5
Ooad Unit-5
Ooad Unit-5
UNIT V TESTING
Introduction.
Object oriented methodologies are set of methods, models, and rules for
developing systems. Modeling can be done during any phase of the software life cycle
.A model is a an abstraction of a phenomenon for the purpose of understanding the
methodologies .Modeling provides means of communicating ideas which is easy to
understand the system complexity .
1
JCE/IT 2021-22
A methodology is explained as the science of methods. A method is a set of
procedures in which a specific goal is approached step by step. Too min any
Methodologies have been reviewed earlier stages.
In 1986, Booch came up with the object-oriented design concept, the Booch
method.
In 1987,Sally Shlaer and Steve Mellor came up with the concept of the
recursive design approach.
In 1989, Beck and Cunningham came up with class-responsibility collaboration
(CRC) cards.
In 1990,Wirfs-Brock, Wilkerson, and Wiener came up with responsibility
driven design.
In 1991, Peter Coad and Ed Yourdon developed the Coad lightweight and
prototype-oriented approach. In the same year Jim Rumbaugh led a team at the
research labs of General Electric to develop the object modeling technique
(OMT).
In 1994,Ivar Jacobson introduced the concept of the use case.
2
JCE/IT 2021-22
1. Analysis. The results are objects and dynamic and functional models.
2. System design. The result is a structure of the basic architecture of the system.
3. Object design. This phase produces a design document, consisting of detailed
objects and dynamic and functional models.
4. Implementation. This activity produces reusable, extendible, and robust code.
1. An object model, presented by the object model and the data dictionary.
2. A dynamic model, presented by the state diagrams and event flow diagrams.
3. A functional model, presented by data flow and constraints.
The above example provides OMT object model of a bank system. The boxes
represent classes and the filled triangle represents specialization.
Association between Account and Transaction is one-to-many. Since one
account can have many transactions, the filled circle represents many (zero or
more).
3
JCE/IT 2021-22
The relationship between Client and Account classes is one-to-one. A client
can have only one account and account can belong to only one person (in this
model joint accounts are not considered )
Here the round boxes represent states and the arrows represent transitions
• The OMT DFD shows the flow of data between different process in a business
• Process is any function being performed ; For Ex, verify password or PIN in the
ATM system
• Data flow shows the direction of data element movement: foe Ex. PIN code
• Data store is a location where data are stored: for ex. Account is a data store in the
ATM example
• External entity is a source or destination of a data element; fro ex. The ATM card
Reader
4
JCE/IT 2021-22
On the whole , the Rumbaugh et al .OMT methodology provides one of the strongest
tool sets for the analysis and design of object-oriented systems .
5
JCE/IT 2021-22
The above example is OMT DFD of the ATM system .The data flow lines
include arrows to show the direction of data element movement .The circle represents
processes. The boxes represents external entities .A data store reveals the storage of
data.
• It is a widely used object oriented method that helps us to design the system
using object paradigm.
• The Booch methodology covers the analysis and design phases of systems
development.
• Booch sometimes is criticized for his large set of symbols.
• You start with class and object diagram in the analysis phase and refine these
diagrams in various steps.
– Class diagrams
– Object diagrams
– State transition diagrams
– Module diagrams
– Process diagrams
– Interaction diagrams
6
JCE/IT 2021-22
Example :Alarm class state transition diagram with Booch notation.The arrows
represents specialization
1. Conceptualization :
you establish the core requirements of the system
You establish a set of goals and develop a prototype to prove the concept
7
JCE/IT 2021-22
describe the desired behavior of the system in terms of scenarios or use the interaction
diagram.
Each macro development process has its own micro development process
• The micro process is a description of the day to- day activities by a single or small
group of
s/w developers
• The micro development process consists of the following steps:
1. Identify classes and objects.
2. Identify class and object semantics.
3. Identify class and object relationships.
4. Identify class and object interfaces and implementation.
• The Jacobson et al. methodologies (e.g., OOBE, OOSE, and Objectory) cover the
entire life cycle and stress traceability between the different phases both forward and
backward. This traceability enables reuse of analysis and design work, possibly much
bigger factors in the reduction of development time than reuse of code.
Use Cases
• Use cases are scenarios for understanding system requirements.
• A use case is an interaction between users and a system.
• The use-case model captures the goal of the user and the responsibility of the system
to its users.
8
JCE/IT 2021-22
– The interaction between the use case and its actors, including when the interaction
occurs and what is exchanged. How and when the use case will store data in the
system.
– Exceptions to the flow of events.
Every single use case should describe one main flow events
An exceptional or additional flow of events could be added
The exceptional use case extends another use case to include the additional one
The use-case model employs extends and uses relationships
The extends relationship is used when you have one use case that is similar to
another use case
Abstract Usecase
9
JCE/IT 2021-22
ATM Transaction use cases.
10
JCE/IT 2021-22
– Domain object model. The object of the “real” world are mapped into
the domain object model
– Analysis object model.
– how the source code (implementation) should be carried out and written
– Implementation model.
– represents the implementation of the system
– Test model.
- constitute the test plan, specifications, and reports
11
JCE/IT 2021-22
suggest that prototyping with a tool might be useful during this phase to help
specify user interfaces.
– Design& Implementation phases
The implementation environment must be identified for the design model .
This include factors such as DBMS, distribution of process ,constraints due to
the programming language, available component libraries and incorporation
user interface tools
It may be possible to identify implementation environment concurrently with
analysis. The analysis objects that fit the current implementation environment.
– Testing phase.
Finally Jacobson describes several testing levels and techniques such as unit
testing, integration testing and system testing.
Patterns
A design pattern is defined as that it identifies the key aspects of a common
design sturture that make it useful for creating a reusable object-orinted design . It also
identifies the participating classes and instances their roles and collaborations and the
distribution of responsibilities.[Gamma,Helson,Johnson definition ]
• The pattern has a name to facilitate discussion and the information it represents.
12
JCE/IT 2021-22
The best patterns generate a solution to a problem indirectly—a necessary approach
for the most difficult problems of design.
• It describes a relationship.
Patterns do not just describe modules, but describe deeper system structures and
mechanisms.
Patterns Template
13
JCE/IT 2021-22
Examples
Resulting context
Rationale
Related Patterns
14
JCE/IT 2021-22
Known uses-The known occurrences of the pattern and its application within
existing systems .This helps validate a pattern by verifying that it indeed is a
proven solution to a recurring problem .
AntiPatterns
Capturing Patterns
Patterns should provide not only facts but also tell us a story that captures the
experience they are trying to convey.
A pattern should help its users comprehend existing systems, customize
systems to fit user needs, and construct new systems.
The process of looking for patterns to document is called pattern mining.
• Guidelines for capturing patterns:
– Focus on practicability.-Patterns should describe proven solutuions to recurring
problems rather than the latest scientific results .
– Aggressive disregard of originality.-Pattern writers do not need to be the original
inventor or discoverer of the solutions that they document.
– Non-anonymous review.-Paper submissions are shepherded rather than reviewed. It
contacts the pattern authors and discusses with him or her how the patterns might be
clarified or improved on
– Writers' workshops instead of presentations.-Open forums are used here to improve
the patterns which are lacking
– Careful editing
.-Incorporating all the review comments and insights given by the writers workshops.
Frameworks
• A framework is a way of presenting a generic solution to a problem that can be
applied to all
levels in a development.
15
JCE/IT 2021-22
• A single framework typically encompasses several design patterns and can be viewed
as the
implementation of a system of design patterns.
A definition of object oriented software framework is given by Gamma et al.
16
JCE/IT 2021-22
The unified approach to software development revolves around (but is not limited to)
the following processes and components.
UA Object-Oriented Analysis:
Use-Case Driven
• The use-case model captures the user requirements.
• The objects found during analysis lead us to model the classes.
• The interaction between objects provide a map for the design phase to model the
relationships and designing classes.
UA Object-Oriented Design:
• Booch provides the most comprehensive object-oriented design method.
• However, Booch methods can be somewhat imposing to learn and especially tricky
to figure out where to start.
• UA realizes this by combining Jacobson et al.'s analysis with Booch's design concept
to create a comprehensive design process.
17
JCE/IT 2021-22
OOD Process consists of:
• Design classes , their attributes, methods, associations, structures and protocols,
apply design axioms
• Design the Access Layer
• Design and prototype User Interface
• User satisfaction and usability Test based on the usage / Use cases
• The UA encourages the integration of testing plans from day 1 of the project.
• Usage scenarios or Use Cases can become test scenarios; therefore, use cases will
drive the usability testing.
• You must iterate and reiterate until, you are satisfied with the system.
• The UA uses the unified modeling language (UML) to describe and model the
analysis and design phases of system development.
Two-Layer Architecture
In a two-layer system, user interface screens are tied directly to the data through
routines that sit directly behind the screens.
18
JCE/IT 2021-22
This approach results in objects that are very specialized and cannot be reused easily
in other projects.
Three-Layer Architecture
Business Layer
1. The responsibilities of the business layer are very straightforward:
2. model the objects of the business and how they interact to accomplish the business
processes.
19
JCE/IT 2021-22
Business Layer: Real Objects
Access Layer
• The access layer contains objects that know how to communicate with the place
where the data actually resides,
•Whether it be a relational database, mainframe, Internet, or file.
• The access layer has two major responsibilities:
• Translate request-This layer must be able to translate any data-related requests from
the business layer into the appropriate protocol for data access.(For eg . if a customer
number 5333 is to be retrieved from the Database , an SQL statement is created by the
access layer and execute it )
• Translate result –It translates the data retrieved back into the appropriate business
objects and passes those objects back up into the business layer
20
JCE/IT 2021-22
5.2 SOFTWARE QUALITY ASSURANCE
Debugging Tools
• Debugging tools are a way of looking inside the program to help us determine what
happens and why.
• It basically gives us a snapshot of the current state of the program.
Testing Strategies
21
JCE/IT 2021-22
Bottom-up Testing
• In a black box, the test item is treated as "black" whose logic is unknown.
• All that's known is what goes in and what comes out, the input and output
• Black box test works very nicely in testing objects in an Object-Oriented
environment.
White box testing assumes that specific logic is important, and must be tested
to guarantee system’s proper functioning. This testing looks for bugs that have a low
probability of execution that has been overlooked in previous investigations. The main
use of this testing is error-based testing , when all level based objects are tested
carefully .
Statement testing coverage- The main idea of the statement testing coverage is
test every statement in the objects method executing it at least once.
22
JCE/IT 2021-22
Branch testing coverage –The main idea here is to perform enough tests to
ensure that every branch alternative has been executed at least once under some
test. It is feasible to fully test any program of considerable size.
Top-down Testing
It assumes that the main logic of the application needs more testing than supporting
logic.
Bottom-up Approach
• It takes an opposite approach.
• It assumes that individual programs and modules are fully developed as standalone
processes.
• These modules are tested individually, and then combined for integration testing.
Validation
- "Am I building the right product?"
• The process of designing view layer classes consists of the following steps:
1. In the macro-level user interface (UI) design process, identify view layer objects.
23
JCE/IT 2021-22
• Defining users. Who are the users?
• A means for measuring effectiveness, efficiency, and satisfaction
The phrase two sides of the same coin is helpful for describing the relationship
between the
Usability and functionality of a system.
Bottom – Up Testing
It supports testing user interface and system integration. In the bottom-up strategy,
each module at lower levels is tested with higher modules until all modules are tested.
It takes help of Drivers for testing
Advantages:
Fault localization is easier.
No time is wasted waiting for all modules to be developed unlike Big-bang
approach
Disadvantages:
Critical modules (at the top level of software architecture) which control the
flow of application are tested last and may be prone to defects.
An early prototype is not possible
Top-down Testing:
In Top to down approach, testing takes place from top to down following the control
flow of the software system. Takes help of stubs for testing. It starts with the details of
the system and proceeds to higher levels by a progressive aggregation of details until
they fit requirements of system.
24
JCE/IT 2021-22
Advantages:
Fault Localization is easier.
Possibility to obtain an early prototype.
Critical Modules are tested on priority; major design flaws could be found and
fixed first.
Disadvantages:
Needs many Stubs.
Modules at a lower level are tested inadequately.
Errors.
٥ Less Plausible ( not worth testing for )
٥ More Plausible ( worth testing for now)
٥ New types of errors may appear
25
JCE/IT 2021-22
Reusability of tests.
Reusable Test Cases and Test Steps is a tool to improve re-usability and
maintainability of Test Management by reducing redundancy between Test Cases in
projects. Often the Test scenarios require that some Test Cases and Test Steps contain
repeated or similar actions performed during a Testing cycle.
The models used for analysis and design should be used for testing at the same
time. The class diagram describes relationship between objects .which is a useful
information form testing .Also it shows the inheritance structure which is important
information for error-based testing.
Error based testing techniques search a given class’s method for particular clues of
interests, and then describe how these clues should be tested.
Usability testing
Measures the ease of use as well as the degree of comfort and satisfaction users have
with the software.
• Usability testing must begin with defining the target audience and test goals.
• Run a pilot test to work out the bugs of the tasks to be tested.
• Make certain the task scenarios, prototype, and test equipment work smoothly.
26
JCE/IT 2021-22
• If they become confused or frustrated, it is not a reflection on them.
• Do not interrupt participants during a test.
• If they need help, begin with general hints before moving to specific advice.
• Keep in mind that less intervention usually yields better results.
• Record the test results using a portable tape recorder, or better, a video camera.
• You may also want to follow up the session with the user satisfaction test.
• The test is inexpensive, easy to use and it is educational to those who administrate it
and those who fill it out. Even if the results may never be summarized, or filled out,
the process of creating the test itself will provide us with useful information.
A test case is a set of What – if questions. To test a system you must construct some
best input cases, that describe how the output will look. Next, perform the tests and
compare the
outcome with the expected output.
Freedman and Thomas have developed guidelines that have been adopted for the UA:
27
JCE/IT 2021-22
test the abnormal but reasonable use of the objects methods.
test the boundary conditions.
Test objects interactions and the messages sent among them.
Attempting to reach agreement on answers generally will raise other what-if
questions.
The internal quality of the software, such as its reusability and extensibility,
should be assessed as well.
٭A Test plan is developed to detect and identify potential problems before delivering
the
software to its users.
٭A test plan offers a road map.
٭A dreaded and frequently overlooked activity in software development.
Steps
Objectives of the test.- create the objectives and describes how to achieve them
Development of a test case- develop test case, both input and expected output.
Test analysis.- This step involves the examination of the test output and the
documentations of the test results
Regression Testing.- All passed tests should be repeated with the revised program,
called "Regression". This can discover errors introduced during the debugging
process. When sufficient testing is believed to have been conducted, this fact should
be reported, and testing to this specific product is complete
Beta Testing.
Beta Testing can be defined as the second stage of testing any product before
release where a sample of the released product with minimum features and
characteristics is being given to the intended audience for trying out or temporarily
using the product.
Unlike an alpha test, the beta test is being carried out by real users in the real
environment. This allows the targeted customers to dive into the product's design,
working, interface, functionality, etc.
Alpha Testing.
Alpha Testing can be defined as a form of acceptance testing which is carried
out for identifying various types of issues or bugs before publishing the build or
executable of software public or market. This test type focuses on the real users
28
JCE/IT 2021-22
through black box and white box testing techniques. The focus remains on the task
which a general user might want or experience.
Alpha testing any product is done when product development is on the verge of
completion. Slight changes in design can be made after conducting the alpha test. This
testing methodology is performed in lab surroundings by the developers.
Here developers see things in the software from users point and try to detect the
problems. These testers are internal company or organization's employees or may be a
part of the testing team. Alpha testing is done early at the end of software
development before beta testing.
Guidelines (for preparing test plan)
Specify Requirements generated by user.
Specify Schedule and resources.
Determine the testing strategy.
Configuration Control System.
Keep the plan up to date.
At the end of each milestone, fill routine updates.
29
JCE/IT 2021-22
MYER’S DEBUGGING PRINCIPLES
Debugging principles.
Case study :
Develping Test cases for vianet ATM bank system
Test cases are derived from the following use case scenarios
1. Bank Transaction
2. Checking transaction history
3. Savings/current account
4. Deposit/Withdarw
5. valid/invalid PIN
30
JCE/IT 2021-22