Docsity

Program Testing in Computer Science: Handout - Prof. Ronnie W. Smith, Exams of Computer Science

Toggle sidebar
bg1
Computer Science 3310
Handout
Some comments/ideas on program testing.
1. Program testing can be considered as planned debugging. That is, you are trying to foresee
where potential problems may occur, and eliminate them before final submission of your
program.
2. The key to program testing is the test case. This consists of your input, your prediction of the
behavior of your program based on the input, and the actual execution of your program on the
input data to verify that your program behaves as it should.
3. You need more than one test case to adequately test your programs. General classes of test
cases include: error cases; normal cases; and boundary cases, cases that test the limits of your
assumptions. An example of a boundary case for program 1 would be the situation where a
customer does not make any purchases.
4. Because the complexity of the programs you are writing has increased, it is a good idea to
separately test your functions as much as possible in order to be sure that parts of your
program are working before you develop other portions of the program. That is one of the
reasons for doing your first program in several parts. Get the I/O working and the search
before you start worrying about customer purchases.
5. In testing functions and in general for debugging your programs, it is helpful to include output
statements for printing out values of variables to ensure your program is correct. In using such
"informational" output statements, here are some suggestions:
•
Define functions that output information.
•
Use your output statements before and after function calls to insure the function is
doing what it is supposed to.
•
When submitting the final version of your program, it is okay to leave such debugging
functions as part of your code, but be sure you comment out the calls to such functions
and output statements. When I'm evaluating your program, I am primarily interested in
the output that I have required it to produce. It is very difficult to wade through alot of
debugging output, and I ask you to do this as a courtesy to me.
6. The purpose of the test plan that I ask you to turn in is to promote in-depth thinking about the
program and how to insure it works correctly. Your test plan writeup should allow me to
replicate your tests (good science allows for replication of experiments), but I want you to be
as concise as possible in your description. One or two pages will normally be sufficient.

Partial preview of the text

Download Program Testing in Computer Science: Handout - Prof. Ronnie W. Smith and more Exams Computer Science in PDF only on Docsity!

Computer Science 3310

Handout

Some comments/ideas on program testing.

  1. Program testing can be considered as planned debugging. That is, you are trying to foresee where potential problems may occur, and eliminate them before final submission of your program.
  2. The key to program testing is the test case. This consists of your input, your prediction of the behavior of your program based on the input, and the actual execution of your program on the input data to verify that your program behaves as it should.
  3. You need more than one test case to adequately test your programs. General classes of test cases include: error cases; normal cases; and boundary cases, cases that test the limits of your assumptions. An example of a boundary case for program 1 would be the situation where a customer does not make any purchases.
  4. Because the complexity of the programs you are writing has increased, it is a good idea to separately test your functions as much as possible in order to be sure that parts of your program are working before you develop other portions of the program. That is one of the reasons for doing your first program in several parts. Get the I/O working and the search before you start worrying about customer purchases.
  5. In testing functions and in general for debugging your programs, it is helpful to include output statements for printing out values of variables to ensure your program is correct. In using such "informational" output statements, here are some suggestions: - Define functions that output information. - Use your output statements before and after function calls to insure the function is doing what it is supposed to. - When submitting the final version of your program, it is okay to leave such debugging functions as part of your code, but be sure you comment out the calls to such functions and output statements. When I'm evaluating your program, I am primarily interested in the output that I have required it to produce. It is very difficult to wade through alot of debugging output, and I ask you to do this as a courtesy to me.
  6. The purpose of the test plan that I ask you to turn in is to promote in-depth thinking about the program and how to insure it works correctly. Your test plan writeup should allow me to replicate your tests (good science allows for replication of experiments), but I want you to be as concise as possible in your description. One or two pages will normally be sufficient.