How Can I say that My Software is Correct
This is a typical question coming to the mind of every programmer / tester. However to get an answer for it, we must try to understand as to how the software can fail. Failure of a piece of software is generally implied as its non-conformance to the requirements.
Software failure can be due to many faults, few of which are given below.
- Error or incompleteness in the requirements.
- Difficulty in implementing the specification in the target environment.
- Faulty system or program design.
- Defects in the code
In view of the variety of faults mentioned above, it is evident that testing cannot be seen as an activity, which will start after the coding phase. In fact software testing is an activity which encompasses the entire development life cycle. Our aim must be to test a program to demonstrate the existence of a fault.
One of the best fundamental book on testing – “The Art of Software Testing – by Myers” describes the following most important testing
principles:
- (Definition): Testing is the process of executing a program with the intent of finding errors
- A good test case is one that has a high probability of detecting an as-yet undiscovered error
- A successful test case is one that detects an as-yet-undiscovered error.
Some more testing principles as given below:
- Test case definition includes expected output.
- Programmers should avoid testing their own programs. Third party testing should be explored.
- Thoroughly Inspect the results of every test.
- Include the test cases for invalid & unexpected input conditions.
- See whether the program does what it is not supposed to do.
- Avoid throwaway test cases. Remember that the test cases serve as a documentation for future maintenance.
- Do not assume that the program is bug free. Positive dissatisfaction of a non-developer, rather a destructive mindset is needed.
- The probability of more errors is proportional to the number of errors already found
It is clear from the definition of testing that:
- Testing cannot prove correctness of a program. It is just a bunch of experiments collected to find out the errors.
- The term like 100% error-free code does not exist. Reason being, it is not feasible to conduct exhaustive testing, thereby proving 100% correctness of the program, which is not possible.
We need to develop an attitude for �ego-less programming� and keep a goal of eliminating as many faults as possible. Statistics on common sense declare that prevention is better than cure. Hence we need to place static testing also in place to capture an error before it becomes a defect in the software at a later date.
Recent agile methodologies like extreme programming addresses these issues better with practices like test-driven programming and paired programming etc.
Many More Articles in Startup Kit for Software Testing
An expert on R&D, Online Training and Publishing. He is M.Tech. (Honours) and is a part of the STG team since inception.