Ooad Unit-V
Ooad Unit-V
Ooad Unit-V
Testing
Object Oriented Methodologies –Software Quality Assurance – Impact of Object Orientation on
Testing – Develop Test cases and Test Plans.
b. OMT Models
I. Object Model
It depicts the object classes and their relationships as a class diagram, which represents the static
structure of the system.
It observes all the objects as static and does not pay any attention to their dynamic nature.
c. Design
It specifies all of the details needed to describe how the system will be implemented.
In this phase, the details of the system analysis and system design are implemented.
The objects identified in the system design phase are designed.
2. Object Process Methodology (OPM)
It is also called as second generation methodology.
It was first introduced in 1995.
It has only one diagram that is the Object Process Diagram (OPD) which is used for modeling
the structure, function and behavior of the system.
It has a strong emphasis on modeling but has a weaker emphasis on process.
It consists of three main processes:
I. Initiating: It determines high level requirements, the scope of the system and the resources
that will be required.
II. Developing: It involves the detailed analysis, design and implementation of the system.
III. Deploying: It introduces the system to the user and subsequent maintenance of the system.
6. Increased Quality:
This feature increases in quality is largely a by-product of this program reuse.
7. Maintainable:
The OOP method makes code more maintainable.
The objects can be maintained separately, making locating and fixing problems easier.
8. Scalable:
The object oriented applications are more scalable than structured approach.
It makes easy to replace the old and aging code with faster algorithms and newer technology.
9. Modularity:
The OOD systems are easier to modify.
It can be altered in fundamental ways without ever breaking up since changes are neatly
encapsulated.
10. Modifiability:
It is easy to make minor changes in the data representation or the procedures in an object
oriented program.
The Rumbaugh method is listed first because it is these authors favorite, and we find it a very
friendly and easy methodology. For traditional system analyst's, the Rumbaugh's methodology is
the closest to the traditional approach to system analysis and design, and beginners will
recognize familiar symbols and techniques. The Rumbaugh methodology has its primary
strength in object analysis but it also does an excellent job with object design. Rumbaugh has
three deliverables to the object analysis phase; the Object model, the Dynamic model, and the
functional model. These three models are similar to traditional system analysis, with the
additions for the object model, including definitions of classes along with the classes variables
and behaviors. The Rumbaugh object model is very much like an entity relationship diagram
except that there are now behaviors in the diagram and class hierarchies. The dynamic model is
a "state transition" diagram that shows how an entity changes from one state to another state. The
functional model is the equivalent of the familiar data flow diagrams from a traditional systems
analysis.
The Booch method P-3
Booch's methodology has its primary strength in the object system design. Grady Booch has
included in his methodology a requirements analysis that is similar to a traditional requirements
analysis, as well as a domain analysis phase. Booch's object system design method has four
parts, the logical structure design where the class hierarchies are defined, the physical structure
diagram where the object methods are described. In addition, Booch defines the dynamics of
classes in a fashion very similar to the Rumbaugh method, as well as an analysis of the dynamics
of object instances, where he describes how an object may change state.
Booch methodology is a widely used object-oriented method that helps to design your system
using the object paradigm.
• Is criticized for his large set of symbols.
•It consists of the following diagrams:
Class diagrams.
Object diagrams.
State transition diagrams.
Module diagrams.
Process diagrams.
Interaction diagrams.
• Two processes:
Macro development process
Micro development process.
Software Quality
Schulmeyer and McManus have defined software quality as “the fitness for use of the total
software product”. A good quality software does exactly what it is supposed to do and is
interpreted in terms of satisfaction of the requirement specification laid down by the user.
Quality Assurance
Software quality assurance is a methodology that determines the extent to which a software
product is fit for use. The activities that are included for determining software quality are −
Auditing
Development of standards and guidelines
Production of reports
Review of quality system
Quality Factors
Correctness − Correctness determines whether the software requirements are
appropriately met.
Usability − Usability determines whether the software can be used by different
categories of users (beginners, non-technical, and experts).
Portability − Portability determines whether the software can operate in different
platforms with different hardware devices.
Maintainability − Maintainability determines the ease at which errors can be corrected
and modules can be updated.
Reusability − Reusability determines whether the modules and classes can be reused for
developing other software products.
Object-Oriented Metrics
Metrics can be broadly classified into three categories: project metrics, product metrics, and
process metrics.
Project Metrics
Project Metrics enable a software project manager to assess the status and performance of an
ongoing project. The following metrics are appropriate for object-oriented software projects −
Process Metrics
Process metrics help in measuring how a process is performing. They are collected over all
projects over long periods of time. They are used as indicators for long-term software process
improvements. Some process metrics are −
When individually validated classes are used to create more complex classes in an
application system, the entire subsystem must be tested as whole before it can be
considered to be validated(integration testing).
2.)Implication of Encapsulation.
Encapsulation of attributes and methods in class may create obstacles while testing. As
methods are invoked through the object of corresponding class, testing cannot be
accomplished without object.
In addition, the state of object at the time of invocation of method affects its behavior.
Hence, testing depends not only on the object but on the state of object also, which is
very difficult to acquire.
Test cases designed for base class are not applicable to derived class always (especially,
when derived class is used in different context). Thus, most testing methods require some
kind of adaptation in order to function properly in an OO environment.
4.)Implication of Genericity.
We need to apply white box testing techniques that exercise this change.
ii.)In Tableclass, elemType may have little impact on implementations of the access
methods of the Table. Example: generic (parameterized class) class
Tableclass(elemType) int numberelements; create(); insert(elemType entry);
delete(elemType entry); isEmpty() returns boolean; isentered(elemType entry) returns
boolean; endclass;
But UniqueTable class would need to evaluate the equivalence of elements and this could
vary depending on the representation of elemType. Example: class UniqueTable extends
Table insert(elemType entry); endclass;
4.)Implications of Polymorphism
Each possible binding of polymorphic component requires a seperate set of test cases.
Many server classes may need to be integrated before a client class can be tested.
In object-oriented (OO) paradigm, software engineers identify and specify the objects and
services provided by each object. In addition, interaction of any two objects and constraints on
each identified object are also determined. The main advantages of OO paradigm include
increased reusability, reliability, interoperability, and extendibility.
With the adoption of OO paradigm, almost all the phases of software development have changed
in their approach, environments, and tools. Though OO paradigm helps make the designing and
development of software easier, it may pose new kind of problems. Thus, testing of software
developed using OO paradigm has to deal with the new problems also. Note that object-oriented
testing can be used to test the object-oriented software as well as conventional software.
OO program should be tested at different levels to uncover all the errors. At the algorithmic
level, each module (or method) of every class in the program should be tested in isolation. For
this, white-box testing can be applied easily. As classes form the main unit of object-oriented
program, testing of classes is the main concern while testing an OO program. At the class level,
every class should be tested as an individual entity. At this level, programmers who are involved
in the development of class conduct the testing. Test cases can be drawn from requirements
specifications, models, and the language used. In addition, structural testing methods such as
boundary value analysis are extremely used. After performing the testing at class level, cluster
level testing should be performed. As classes are collaborated (or integrated) to form a small
subsystem (also known as cluster), testing each cluster individually is necessary. At this level,
focus is on testing the components that execute concurrently as well as on the interclass
interaction. Hence, testing at this level may be viewed as integration testing where units to be
integrated are classes. Once all the clusters in the system are tested, system level testing begins.
At this level, interaction among clusters is tested.
Usually, there is a misconception that if individual classes are well designed and have proved to
work in isolation, then there is no need to test the interactions between two or more classes when
they are integrated. However, this is not true because sometimes there can be errors, which can
be detected only through integration of classes. Also, it is possible that if a class does not contain
a bug, it may still be used in a wrong way by another class, leading to system failure.
The methods used to design test cases in OO testing are based on the conventional methods.
However, these test cases should encompass special features so that they can be used in the
object-oriented environment. The points that should be noted while developing test cases in an
object-oriented environment are listed below.
1. It should be explicitly specified with each test case which class it should test.
2. Purpose of each test case should be mentioned.
3. External conditions that should exist while conducting a test should be clearly stated with
each test case.
4. All the states of object that is to be tested should be specified.
5. Instructions to understand and conduct the test cases should be provided with each test
case.
State-based testing is used to verify whether the methods (a procedure that is executed by an
object) of a class are interacting properly with each other. This testing seeks to exercise the
transitions among the states of objects based upon the identified inputs.
For this testing, finite-state machine (FSM) or state-transition diagram representing the possible
states of the object and how state transition occurs is built. In addition, state-based testing
generates test cases, which check whether the method is able to change the state of object as
expected. If any method of the class does not change the object state as expected, the method is
said to contain errors.
To perform state-based testing, a number of steps are followed, which are listed below.
1. Derive a new class from an existing class with some additional features, which are used
to examine and set the state of the object.
2. Next, the test driver is written. This test driver contains a main program to create an
object, send messages to set the state of the object, send messages to invoke methods of
the class that is being tested and send messages to check the final state of the object.
3. Finally, stubs are written. These stubs call the untested methods.
Fault-based Testing P-9
Fault-based testing is used to determine or uncover a set of plausible faults. In other words, the
focus of tester in this testing is to detect the presence of possible faults. Fault-based testing starts
by examining the analysis and design models of OO software as these models may provide an
idea of problems in the implementation of software. With the knowledge of system under test
and experience in the application domain, tester designs test cases where each test case targets to
uncover some particular faults.
The effectiveness of this testing depends highly on tester experience in application domain and
the system under test. This is because if he fails to perceive real faults in the system to be
plausible, testing may leave many faults undetected. However, examining analysis and design
models may enable tester to detect large number of errors with less effort. As testing only proves
the existence and not the absence of errors, this testing approach is considered to be an effective
method and hence is often used when security or safety of a system is to be tested.
Integration testing applied for OO software targets to uncover the possible faults in both
operation calls and various types of messages (like a message sent to invoke an object). These
faults may be unexpected outputs, incorrect messages or operations, and incorrect invocation.
The faults can be recognized by determining the behavior of all operations performed to invoke
the methods of a class.
Scenario-based Testing
Scenario-based testing is used to detect errors that are caused due to incorrect specifications and
improper interactions among various segments of the software. Incorrect interactions often lead
to incorrect outputs that can cause malfunctioning of some segments of the software. The use of
scenarios in testing is a common way of describing how a user might accomplish a task or
achieve a goal within a specific context or environment. Note that these scenarios are more
context- and user specific instead of being product-specific. Generally, the structure of a scenario
includes the following points.
Scenario- based testing combines all the classes that support a use-case (scenarios are subset of
use-cases) and executes a test case to test them. Execution of all the test cases ensures that all
methods in all the classes are executed at least once during testing. However, testing all the
objects (present in the classes combined together) collectively is difficult. Thus, rather than
testing all objects collectively, they are tested using either top-down or bottom-up integration
approach.
This testing is considered to be the most effective method as scenarios can be organized in such a
manner that the most likely scenarios are tested first with unusual or exceptional scenarios
considered later in the testing process. This satisfies a fundamental principle of testing that most
testing effort should be devoted to those paths of the system that are mostly used.
Traditional testing methods are not directly applicable to OO programs as they involve OO
concepts including encapsulation, inheritance, and polymorphism. These concepts lead to issues,
which are yet to be resolved. Some of these issues are listed below.
Encapsulation of attributes and methods in class may create obstacles while testing. As methods
are invoked through the object of corresponding class, testing cannot be accomplished without
object. In addition, the state of object at the time of invocation of method affects its behavior.
Hence, testing depends not only on the object but on the state of object also, which is very
difficult to acquire.
Inheritance and polymorphism also introduce problems that are not found in traditional software.
Test cases designed for base class are not applicable to derived class always (especially, when
derived class is used in different context). Thus, most testing methods require some kind of
adaptation in order to function properly in an OO environment.
PART – A
1. What is Object Oriented Methodology?
Object Oriented Methodology asks the analyst to determine
What the objects of the system are?
What responsibilities and relationships an object has to do with the other
objects?
How they behave over time?
PART – B
1. What is OO Methodology? Explain various OO methodologies used in software
development.
2. Explain in detail about various issues in OO testing. [May 2018][May 2017][May 2019]
3. What is OO testing? Explain in detail about concepts of OO testing in OOAD.[Nov
2015]
4. Expalin in detail about software quality assurance.
5. What is test case? How test case is developed and testing is planned?