Software testing: Techniques and approaches for test case design
Testing is an essential and very important part for the creation of a robust and efficient program, which allows to substantially reduce the maintenance costs of the developed program.
Unfortunately, no testing can reduce the probability of not having a bug or failure to zero, as the possible combinations of valid input values are enormous, and cannot be reproduced within a reasonable time. However, good testing can make the probability of malfunctions low enough to be acceptable by the user.
In other words, testing is a procedure used to check a program’s run-time behavior and the goal of testing is to make software as error-free as possible.
No testing can reduce the probability of not having a bug or failure to zero, as the possible combinations of valid input values are enormous, and cannot be reproduced in a reasonable time. However, good testing can make the probability of malfunctions low enough to be acceptable by the user. The main obstacle to testing is summarized in Dijkstra’s thesis. This thesis states that testing can indicate the presence of errors, but cannot guarantee the absence of errors. A direct corollary of this thesis is that error-free software does not exist or cannot be certified.
Design of test cases
The test case design is a part of the system and component testing where the expected inputs and outputs are designed.
The goal of the process is to create a set of tests that is effective in discovering the defects of the program and to show that the system meets its requirements.
To design a test case you select a function of the system or component you are testing and a set of inputs to perform that function, document the expected outputs or their variation fields and, where applicable, design automatic controls that verify that the expected and actual outputs are the same.
There are several approaches to designing test cases:
- test based on requirements: test cases are designed to test system requirements. It is mostly used in the system design phase as the requirements are usually implemented by different components; for each requirement, test cases are identified that can prove that the system satisfies it.
- partition tests: identify the input and output partitions and design the tests so that the system performs all the inputs of all partitions and generates all the outputs in all partitions. Partitions are groups of data that have common characteristics, such as all negative numbers, all names less than 30 characters, all events that result from the choice of objects in a menu and so on.
- structural test: the knowledge of the program structure is used to design tests that carry out all the parts of the program. Essentially when you test a program you should try to execute each instruction at least once. The structural test helps to identify the test cases that can make this possible.
Finally, it must be said that to try to increase effectiveness, cut costs and reduce development times, it would be extremely useful to have tools capable of automatically generating large quantities of test cases, starting from the code or specifications of the program under observation.