Testing is the process of running a program to find errors. It cannot prove that software is free of errors, but it can greatly raise confidence in the software.
Verification and Validation
Verification asks whether the product is being built correctly, which means that it follows its specification. Validation asks whether the right product is being built, which means that it meets the real needs of the customer. A simple memory aid is that verification is "are we building the product right" and validation is "are we building the right product". Both are parts of software quality assurance.
Definition: Software testing. The process of executing a program with the intention of finding errors, in order to judge whether it meets its requirements.
A Strategic Approach
A testing strategy gives a template for testing, which begins with the testing of single components and moves out to the system as a whole. Testing starts at the component level and works outward towards the integration of the full system. Different techniques suit different times, and testing is done by the developer and, for large projects, by an independent test group. Testing and debugging are different activities. Testing finds an error, while debugging locates and removes its cause.
Test Strategies for Conventional Software
Unit testing checks each module in isolation, using drivers, which call the module, and stubs, which stand in for the modules that it calls. Integration testing puts the modules together and checks their interfaces. In top-down integration modules are added from the main control module downward, using stubs. In bottom-up integration they are added from the lowest level upward, using drivers. Big-bang integration combines all at once, which is risky. Regression testing reruns earlier tests after each change, to see that the change has not broken anything. Smoke testing is a quick build test done daily, to see that the main functions work.
A test case has an identity, the condition to be tested, the input data, the steps, the expected result and the actual result. A test suite is a set of test cases, and a test plan states the scope, approach, resources and schedule of testing. Defects found are recorded with their severity and are tracked until they are fixed and retested. Good testers think of ways in which the software could fail, and not only of ways in which it works. Test automation tools run repeated tests, especially regression tests, quickly and without human error, but they cannot replace the judgement of a skilled tester.
Table 3.5: Levels of testing
| Level | Tests | Done by |
|---|---|---|
| Unit | A single module | Developer |
| Integration | Interfaces between modules | Developer or test team |
| System | The complete system | Test team |
| Acceptance | Fitness for the customer's use | Customer |
Example 3.5: Choosing an integration approach
Problem: A project has a main control module and several lower modules that are still being written. Which integration approach lets testing begin early?
Solution:
- The control module is ready, but the lower modules are not.
- Top-down integration can proceed with stubs in place of the missing modules.
Result: Top-down integration with stubs allows early testing of the main logic.
Common mistakes
- Believing that testing can prove that software has no errors.
- Confusing testing with debugging.
- Skipping regression testing after a small change.
Key takeaways
- Verification asks if the product is built right, validation asks if it is the right product.
- Testing moves from units to integration to system.
- Stubs stand in for called modules, drivers call the module under test.
- Regression testing repeats earlier tests after a change.
Practice questions
- Distinguish verification and validation.
- What is a stub?
- What is regression testing?
Answers to the practice questions
- Verification checks that the product is built correctly, validation checks that it is the right product for the customer.
- A small program that stands in for a module called by the module under test.
- Re-running earlier tests after a change to check that nothing has broken.
Sources
- Official BCA syllabus Software Engineering, course code 26BCA403DS03, Unit III
