
Available under Creative Commons-ShareAlike 4.0 International License.
Test data consists of the user providing some input values and predicting the outputs. This can be quite easy for a simple program and the test data can be used twice.
- to check the model to see if it produces the correct results (model checking)
- to check the coded program to see if it produces the correct results (code checking)
Test data is developed by using the algorithm of the program. This algorithm is usually documented during the program design with either fowcharting or pseudocode. Here is the pseudocode in outline form describing the inputs, processing and outputs for a program used for painting rectangular buildings.
Example 2.2: Pseudocode using an IPO Outline for Painting a Rectangular Building
Input display a message asking user for the length of the building get the length from the keyboard display a message asking user for the width of the building get the width from the keyboard display a message asking user for the height of the building get the height from the keyboard display a message asking user for the price per gallon of paint get the price per gallon of paint from the keyboard display a message asking user for the sq ft coverage of a gallon of paint get the sq ft coverage of a gallon of paint from the keyboard Processing calculate the total area of the building by: multiplying the length by height by 2 then multiply the width by height by 2 then add the two results together calculate the number of gallons of paint needed by: dividing the total area by the coverage per gallon then round up to the next whole gallon calculate the total cost of the paint by: multiplying the total gallons needed by the price of one gallon of paint Output display the number of gallons needed on the monitor display the total cost of the paint on the monitor pause so the user can see the answer
- 瀏覽次數:2076