--Originally published at Hackerman's house
Testing takes a big part in software development. It is important to know how to do the testing so that you can solve the problems presented and spend less time in this stage. Object-Oriented testing is different from traditional testing. The root of this differences is that traditional programming consists of procedures operating on data, while OO testing treats with objects that are instances of classes.
There are several testing levels when you are doing OO testing.
Each module or method of every class should be tested in isolation.
Every class should be tested as an individual entity.
As classes are collaborated or integrated to form a small subsystem or cluster. Testing each cluster individually becomes a necessity.
At this level, interaction among the clusters is tested.
Methods to design OO test cases are based on the conventional methods, but the should encompass some special features to that they can be used in the object-oriented environment.
- 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.
State based testing is used to verify if the methods of a class are interacting properly with each other. The basic idea of this method is that an object is created, and several methods are invoked to see if the object is changing states the way it should.
Scenario-based testing is used to detect errors that are caused due to incorrect specifications improper interactions among segments of the software. The structure of this tests requires a condition under the scenario runs. You have to define the goal, steps and the final condition under which the goal is achieved.
There are a lot more tests that can be done in OO design but these are some of the most important ones.