ICS 52: Introduction to Software Engineering

Fall, 2007
Assignment 4: Testing
Due: Friday, December 7, 2007, 1:00 pm.

SUMMARY

In this assignment you will perform unit testing of the Schocr system. You will do White Box testing of your own implementation, and Black Box testing of another implementation (for which you will not have the source code). The focus is on careful and systematic selection of test cases.

The homework is due on Friday, March 16, by 2:00 pm, in ICS 174. There is no electronic submission.

ASSIGNMENT DETAILS

White Box Testing

Select a subset of your Schocr implementation that you want to test using structural testing techniques. Your selection should have between 40 and 60 lines of code, with several (at least seven) if, for, while, switch, or other control-flow modifying statements. The code you select can consist of several related methods.

Turn in a printout of the source code you are testing with a number written next to each line. Draw a control flow graph of the code you are testing. Each node in the graph should have the corresponding number written in it. Make sure it is easy to match up the source code with the graph. (You may use any tool you wish to draw the control flow graph, or you may draw it neatly by hand.)

Develop a set of test cases that will guarantee node coverage for your graph. Fill out the Testing Matrix (one or more pages), making clear which test cases pertain to which nodes. Remember, each node defines a subdomain of the input, specifically the subset of all possible inputs that cause the node to be visited (line to be executed). It's ok to have a test case that applies to more than one node / subdomain.

The Testing Matrix is available as a PowerPoint file or a PDF file. You are welcome to modify the format, but not the basic structure, of the Testing Matrix form.

Run the test cases, and note on the Testing Matrix forms (in the "Notes" column) any unexpected outputs. Do not change the code to fix any errors. You will not lose points because there were bugs in your code!

If you do not have 40 to 60 working lines of code in your implementation, you can use source code that comes from the black box implementation (see next section).



Black Box Testing

For this section of the homework, you will test an implementation that we provide, using specification-based testing techniques. We will provide class files only, not source code (except for a short amount of source code you can use for White Box testing). The class files and data files to test will be in the zip file http://www.ics.uci.edu/~frost/ics52/BlackBox.zip (not available yet). After you unzip the file's contents, you can start our black box implementation by typing java Schocr at the command prompt. Even before the black box implementation is available, you can be working on developing test cases.

You will test two areas of the Black Box implementation's functionality:

  1. Teacher's capability of specifying first, second, and third choice of time and room (P-2) and (P-4).
  2. Each course must be scheduled in time periods that add up to the appropriate number of hours per week.(HR-5).
For each of these areas of functionality determine three bases. Make sure that each basis is truly a criterion or test with which you can divide the domain of all possible inputs into subdomains. For each basis list a reasonable number of sub-domains (usually three to six), and one or two test cases for each sub-domain. Use copies of the Testing Matrix to record the test cases that you create. Run the test cases, write on the Testing Matrix forms the outputs, and note any unexpected results. If you got the expected output, write "OK" or a check mark. Your input to a test case will often be one or more teachers, substitutes, dates, and other information, so feel free to modify or annotate the Testing Matrix to indicate in a clear way sets of inputs that you are using.

WHAT TO TURN IN

Turn in a document containing the following items, in this order: Staple your entire document together. Do not enclose your document in a binder or envelope.










HW4 Cover Sheet

ICS 52 - Fall, 2007 - Homework 4



Student Name (Last, First):
Student Number:



Awarded Points Available Points  
  10 Control flow graph
  20 White Box testing
  10 Overview of errors found in Black Box testing
  30 Black Box testing - Teachers' choices (P-2) and (P-4)
  30 Black Box testing - Time Periods (HR-5)
  100 TOTAL