In object-oriented (OO) paradigm, for software testing the engineer must 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, all these become the scope of the testing.
OO program should be tested at different levels to uncover all the errors. white-box testing can be applied easily at the algorithmic level, which means that each module (or method) of every class in the program should be tested in isolation. For the testing of classes, every class should be tested as an individual entity. At this level, programmers who are involved in the development of class conduct the testing. 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.
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.
One common misconception is that if individual classes are well designed and have proved to work in isolation, then they work well 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 parts of a test case are:
- It should be explicitly specified with each test case which class it should test.
- Purpose of each test case should be mentioned.
- External conditions that should exist while conducting a test should be clearly stated with each test case.
- All the states of object that is to be tested should be specified.
- Instructions to understand and conduct the test cases should be provided with each test case.
There are 3 testing methods:
State-based testing: is used to verify whether the methods of a class are interacting properly with each other. For this testing, finite-state machine (FSM) representing the possible states of the object and how state transition occurs.
Fault-based testing: is used to determine or uncover a set of plausible 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 this knowledge the tester designs test cases which aim to uncover some particular faults.
Scenario-based testing: is used to detect errors that are caused due to incorrect specifications and improper interactions among various segments of the software. The structure of a scenario includes the following points.
- A condition under which the scenario runs.
- A goal to achieve, which can also be a name of the scenario.
- A set of steps of actions.
- An end condition at which the goal is achieved.
- A possible set of extensions written as scenario fragments.
References
Thaku, D. (n.d.). Object-Oriented Testing. EComputer Notes. http://ecomputernotes.com/software-engineering/object-oriented-testing








