Understanding unit and integration tests
Delaying the application testing until immediately after most of its functionalities have been completely implemented must be avoided for the following reasons:
- If a class or module has been incorrectly designed or implemented, it might have already influenced the way other modules were implemented. Therefore, at this point, fixing the problem might have a very high cost.
- The possible combination of input that is needed to test all possible paths that execution can take grows exponentially with the number of modules or classes that are tested together. Thus, for instance, if the execution of a class method
A
can take three different paths, while the execution of another methodB
can take four paths, then testingA
andB
together would require 3 x 4 different inputs. In general, if we test several modules together, the total number of paths to test is the product of the number of paths to test in each module. If modules are...