Chapter 10

Static Testing the Program Unit Design

The design phase develops the physical architecture, or structural aspects, of the system. The program unit design phase is refined to enable detailed design. The program unit design is the detailed design in which specific algorithmic and data structure choices are made. It is the specifying of the detailed flow of control that will make it easily translatable to program code with a programming language.

Testing the Program Unit Design with Technical Reviews

A good detailed program unit design is one that can easily be translated to many programming languages. It uses structured techniques such as while, for, repeat, if, and case constructs. These are examples of the constructs used in structured programming. The objective of structured programming is to produce programs with high quality at low cost. A structured program is one in which only three basic control constructs are used.

Sequence

Statements are executed one after another in the same order that they appear in the source listing. An example of a sequence is an assignment statement.

Selection

A condition is tested and, depending on whether the test is true or false, one or more alternative execution paths are traversed. An example of a selection is an if-then-else. With this structure, the condition is tested and, if found to be true, one set of instructions is executed. If the condition is false, another set of instructions is executed. Both sets join at a common point.

Iteration

Iteration is used to execute a set of instructions a number of times with a loop. Examples of iteration are dountil and dowhile. A dountil loop executes a set of instructions and then tests the loop termination condition. If it is true, the loop terminates and continues to the next construct. If it is false, the set of instructions is executed again until the termination logic is reached. A dowhile loop tests the termination condition. If it is true, control passes to the next construct. If it is false, a set of instructions is executed until control is unconditionally passed back to the condition logic.

Static analysis of the detailed design detects semantic errors involving information and logic control flow. Each defect uncovered during the program unit design review should be documented, categorized, recorded, presented to the design team for correction, and referenced to the specific document in which the defect was noted. Table 10.1 shows a sample program unit design phase defect recording form (see Appendix F4, “Program Unit Design Phase Defect Checklist,” for more details).

Creating Unit Test Cases

Unit testing is the process of executing a functional subset of the software system to determine whether it performs its assigned function. It is oriented toward the checking of a function or a module. White-box test cases are created and documented to validate the unit logic and black-box test cases to test the unit against the specifications (see Appendix E8, “Test Case,” for a sample test case form). Unit testing, along with the version control necessary during correction and retesting, is typically performed by the developer. During unit test case development, it is important to know which portions of the code have been subjected to test cases and which have not. By knowing this coverage, the developer can discover lines of code that are never executed or program functions that do not perform according to the specifications. When coverage is inadequate, implementing the system is risky because defects may be present in the untested portions of the code (see Appendix G, “Software Testing Techniques,” for more unit test case development techniques). Unit test case specifications are started and documented in the Test Specification section (see Appendix E2, “System/Acceptance Test Plan”), but all other items in this section should have been completed.

Table 10.1   Program Unit Design Phase Defect Recording

Images

All items in the Introduction, Test Approach and Strategy, Test Execution Setup, Test Tools, and Personnel Resources should have been completed prior to this phase. Items in the Test Procedures section, however, continue to be refined. The functional decomposition, integration, system, and acceptance test cases should be completed during this section. Refinement continues for all items in the Test Procedures and Test Schedule sections.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset