Testing of each program individually is called as Unit Testing. Irrespective of the dependency of the program on the other programs of the system, this kind of testing is done independent of other programs.
When the program needs to interact with the other program(s), dummy program(s) will be developed, which do nothing but simply supply or accept the data that is used for communicating with the original program(s).
Generally, Unit Test will be conducted in two ways:
A) White box testing, and
B) Black box testing.
White box testing constitutes the testing of the internal logic of the program. For this, each and every condition that can arise should be tested. This is also called as Structural Testing.
Whereas the Black box testing is concerned with what will be the output for a particular input. It has nothing to do with the internal logic or how the program functions to get the output. Black box testing is also called as Functional Testing.
For preparing the test plans for unit testing, one has to consider the negative conditions, positive conditions and also the intermediate conditions.
Negative cases are nothing but abend cases, i.e. the cases when the program terminates abnormally.
For example: Dataset being empty when it should not be.
DB2 table being empty when it should not be.
Positive cases are those with the test data being normal, which leads to the successful completion of the program. These are based upon the negative cases. For every negative case, or a group of negative cases, a positive case should be tested.
For example: For all the file related negative cases, a positive case should be tested with all the necessary files being provided with appropriate data being filled into.
Intermediate cases are those in which every condition is being emphasized. This will cover those conditions which, in all ways, lead to positive results
For example: IF (A>B)
A=A+B
ELSE
IF (B>A)
B=A+B
ELSE
CONTINUE
END-IF
END-IF;
In the above pseudo-code, assuming that the program will be terminated successfully if continued from here, the functionality of the program is different in each case. The three cases that come into picture are A>B, B>A, A==B. Even though the program terminates successfully, the end results also depend on the above intermediate conditions. But the third condition, A==B, will not make any effect on the program. Hence, the first two intermediate conditions should be entered into the Unit Test Plan, leaving aside the third condition A==B.
One point to note is that the negative and positive conditions constitute the Black box testing whereas the intermediate conditions constitute the White box testing.
Also note that all the intermediate cases are part of positive cases.
No comments:
Post a Comment