<< Chapter < Page Chapter >> Page >
An explanation of test data with an example developed from a simple program documented with pseudocode.


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.

  1. to check the model to see if it produces the correct results ( model checking )
  2. 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 flowcharting or pseudocode. Here is the pseudocode in outline form describing the inputs, processing and outputs for a program used for painting rectangular buildings.

Pseudocode using an ipo outline for painting a rectangular building

Input display a message asking user for the length of the buildingget the length from the keyboard display a message asking user for the width of the buildingget the width from the keyboard display a message asking user for the height of the buildingget the height from the keyboard display a message asking user for the price per gallon of paintget the price per gallon of paint from the keyboard display a message asking user for the sq ft coverage of a gallon of paintget the sq ft coverage of a gallon of paint from the keyboard Processingcalculate the total area of the building by: multiplying the length by height by 2then multiply the width by height by 2 then add the two results togethercalculate the number of gallons of paint needed by: dividing the total area by the coverage per gallonthen 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 Outputdisplay the number of gallons needed on the monitor display the total cost of the paint on the monitorpause so the user can see the answer

Got questions? Get instant answers now!

Creating test data and model checking

Test data is used to verify that the inputs, processing and outputs are working correctly. As test data is initially developed it can verify that the documented algorithm (pseudocode in the example we are doing) is correct. It helps us understand and even visualize the inputs, processing and outputs of the program.

Inputs: My building is 100 feet long by 40 feet wide and 10 feet in height and I selected paint costing $28.49 per gallon that will cover 250 square feet per gallon. We should verify that the pseudocode is prompting the user for this data.

Processing: Using my solar powered hand held calculator, I can calculate (or predict) the total area would be: (100 x 10 x 2 plus 40 x 10 x 2) or 2,800 sq ft. The total gallons of paint would be: (2800 / 250) or 11.2 gallons. But rounded up, I would need twelve (12) gallons of paint. The total cost would be: (28.49 times 12) or $341.88. We should verify that the pseudocode is performing the correct calculations.

Output: Only the significant information (number of gallons to buy and the total cost) are displayed for the user to see. We should verify that the appropriate information is being displayed.

Testing the coded program – code checking

The test data can be developed and used to test the algorithm that is documented (in our case our pseudocode) during the program design phase. Once the program is code with compiler and linker errors resolved, the programmer gets to play user and should test the program using the test data developed. When you run your program, how will you know that it is working properly? Did you properly plan your logic to accomplish your purpose? Even if your plan was correct, did it get converted correctly (coded) into the chosen programming language (in our case C++)? The answer (or solution) to all of these questions is our test data.

By developing test data we are predicting what the results should be, thus we can verify that our program is working properly. When we run the program we would enter the input values used in our test data. Hopefully the program will output the predicted values. If not then our problem could be any of the following:

  1. The plan (IPO outline or other item) could be wrong
  2. The conversion of the plan to code might be wrong
  3. The test data results were calculated wrong

Resolving problems of this nature can be the most difficult problems a programmer encounters. You must review each of the above to determine where the error is lies. Fix the error and re-test your program.


model checking
Using test data to check the design model (usually done in pseudocode).
code checking
Using test data to check the coded program in a specific language (like C++).

Questions & Answers

Is there any normative that regulates the use of silver nanoparticles?
Damian Reply
what king of growth are you checking .?
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
Stoney Reply
why we need to study biomolecules, molecular biology in nanotechnology?
Adin Reply
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
what school?
biomolecules are e building blocks of every organics and inorganic materials.
anyone know any internet site where one can find nanotechnology papers?
Damian Reply
sciencedirect big data base
Introduction about quantum dots in nanotechnology
Praveena Reply
what does nano mean?
Anassong Reply
nano basically means 10^(-9). nanometer is a unit to measure length.
do you think it's worthwhile in the long term to study the effects and possibilities of nanotechnology on viral treatment?
Damian Reply
absolutely yes
how to know photocatalytic properties of tio2 nanoparticles...what to do now
Akash Reply
it is a goid question and i want to know the answer as well
characteristics of micro business
for teaching engĺish at school how nano technology help us
Do somebody tell me a best nano engineering book for beginners?
s. Reply
there is no specific books for beginners but there is book called principle of nanotechnology
what is fullerene does it is used to make bukky balls
Devang Reply
are you nano engineer ?
fullerene is a bucky ball aka Carbon 60 molecule. It was name by the architect Fuller. He design the geodesic dome. it resembles a soccer ball.
what is the actual application of fullerenes nowadays?
That is a great question Damian. best way to answer that question is to Google it. there are hundreds of applications for buck minister fullerenes, from medical to aerospace. you can also find plenty of research papers that will give you great detail on the potential applications of fullerenes.
what is the Synthesis, properties,and applications of carbon nano chemistry
Abhijith Reply
Mostly, they use nano carbon for electronics and for materials to be strengthened.
is Bucky paper clear?
carbon nanotubes has various application in fuel cells membrane, current research on cancer drug,and in electronics MEMS and NEMS etc
so some one know about replacing silicon atom with phosphorous in semiconductors device?
s. Reply
Yeah, it is a pain to say the least. You basically have to heat the substarte up to around 1000 degrees celcius then pass phosphene gas over top of it, which is explosive and toxic by the way, under very low pressure.
Do you know which machine is used to that process?
how to fabricate graphene ink ?
for screen printed electrodes ?
What is lattice structure?
s. Reply
of graphene you mean?
or in general
in general
Graphene has a hexagonal structure
On having this app for quite a bit time, Haven't realised there's a chat room in it.
what is biological synthesis of nanoparticles
Sanket Reply
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get the best Algebra and trigonometry course in your pocket!

Source:  OpenStax, Programming fundamentals - a modular structured approach using c++. OpenStax CNX. Jan 10, 2013 Download for free at http://cnx.org/content/col10621/1.22
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Programming fundamentals - a modular structured approach using c++' conversation and receive update notifications?