CH - 5 Object Oriented Testing
CH - 5 Object Oriented Testing
Chapter Five
• The goal of testing is to design tests that detect defects in the system
and to reveal problems.
Unity University 3
Test Planning
• Testing starts with the development of a test plan, which defines a
series of tests that will be conducted.
Unity University 4
Cont.
• The test plan should address all products that are created during the
development of the system.
• Each individual test has a specific objective and describes a set of very
specific test cases to examine.
• Not all classes are likely to be finished at the same time, so the
programmer usually writes stubs for the unfinished classes to enable
the classes around them to be tested.
Unity University 5
Unit Testing
• Unit tests focus on a single unit—the class.
Unity University 7
Cont.
White-Box Testing
• By looking inside the class to review the code itself, the tester may
discover errors or assumptions not immediately obvious to someone
treating the class as a black box.
Unity University 8
Integration Testing
• Integration tests assess whether a set of classes that must work together
do so without error.
• They ensure that the interfaces and linkages between different parts
of the system work properly.
• At this point, the classes have passed their individual unit tests, so the
focus now is on the flow of control among the classes and on the
data exchanged among them.
• The tester develops a test plan that has a series of tests, which, in turn,
have a test.
Unity University 10
Cont.
User Interface Testing
• Testing is done by moving through each and every menu item in the
interface either in a top-down or bottom-up manner.
Test plan source: Interface Design
When to use: For normal integration testing
Unity University 11
Cont.
Use-Case Testing
• Testing is done by moving through each use case to ensure that they
work correctly.
Unity University 12
Interaction Testing Cont.
• Tests each process in step-by-step fashion.
• Each class is added in turn and the results of the class compared to
correct result from the test data; when a class passes, the next class is
added and the test rerun.
• This is done for each package. Once each package has passed all
tests, then the process repeats integrating the packages.
Test plan source: class diagrams, sequence diagrams,
communication diagrams
When to use: When the system performs data processing
Unity University 13
Cont.
System Interface Testing
• Because data transfers between systems are often automated and not
monitored directly by the users, it is critical to design tests to ensure
that they are being done correctly.
Unity University 14
System Testing
• To ensure that all classes work together without error, systems analysts
usually conduct the system tests.
Unity University 15
Cont.
Requirements Testing
• Often done by analyst with experience in how users think and in good
interface design
Test plan source: Interface design and use cases
When to use: When user interface is important
Unity University 17
Cont.
Documentation Testing
Unity University 18
Cont.
Performance Testing
• Fall into two categories: stress tests(load test) and volume tests.
• The purpose of stress tests is to ensure that the system can handle a
certain number of simultaneous requests.
• Authentication: deals with ensuring that the logged in user is who he or she
claims to be
• Authorization: deals with ensuring that the logged in user actually has the
authority to use the system(s) being accessed.
• Given that many system break-ins are a function of viruses, virus controls
also need to be enforced
Test plan source: Infrastructure design
Unity University 20
Acceptance Testing
• Acceptance testing is done primarily by the users with support from
the project team.
• The goal is to confirm that the system is complete, meets the business
needs that prompted the system to be developed, and is acceptable to
the users.
Unity University 21
Cont.
Alpha Testing
• Conducted by users to ensure that they accept the system
• Often repeats previous tests but are conducted by users themselves to ensure
that they accept the system.
Unity University 22
Cont.
Beta Testing
• Uses real data, not test data
Unity University 23
Testing and Object Orientation
• Most testing techniques have been developed to support non–object-
oriented development.
Unity University 24
Cont.
Unity University 25
Cont.
• Based on all of these different ways classes can be grouped together, how
does one effectively do integration testing?.
Unity University 26
Cont.
Polymorphism and Dynamic Binding
• Affect both unit and integration testing.
• Except for trivial cases, dynamic binding makes it impossible to know which
implementation is going to be executed until the system does it. Therefore,
integration testing becomes very challenging.
Unity University 27
Cont.
Inheritance
• Through the use of inheritance, bugs can be propagated instantaneously from
a superclass to all its direct and indirect subclasses.
• However, the tests that are applicable to a superclass are also applicable to all
its subclasses.
Reuse
• On the surface, reuse should decrease the amount of testing required.
• However, each time a class is used in a different context, the class must be
tested again.