Software Testing - Exhaustive TestsHow many tests are needed to exhaustively test the following logic?PROCEDURE: PATH-COUNTER WHILE NOT End-Of-File READ NEXT RECORD IF FIELD > 7 THEN PUT IN BIG-NUMBER BIN ELSE IF FIELD > 3 THEN PUT IN MID-NUMBER BIN ELSE PUT IN SMALL-NUMBER BIN END IF END WHILE By Basic Logic, we can only prove that the program works if, for each case where the premise is true, the conclusion is true. This requires generating every possible premise - i.e. every possible state that the program can ever have. To estimate the total number of states, consider that there are three primary branches: a) greater than 7, b) between 3 and 7, and c) less than 3. The total number of program states (100% of all real paths), if we assume no more than 100 records, is the total number of possible combinations of three decisions for 100 records, plus the total number of combinations with 99 records, etc. This will give the total number of possible states that the program can ever be in, if we assume that the file can contain no more than 100 records. To exhaustively test, we must test each possible state. And how many tests would that be?
Roughly 10,000 times more tests than the total number of atoms in the planet Earth!So, for the simple 10-line program above, given the fastest modern computer, the time to exhaustively test the program would exceed the life expectancy of the sun! Clearly, exhaustive testing is impossible. Corollary: Since testing can never be exhaustive, there will always be more tests that could be run. That means that the answer to the question: "can you do more testing" is always "Yes," which makes the question meaningless. So, instead of asking "can you do more testing," be specific about what type of testing could be adde |