Class Meeting: Testing


Admin

Assignment

Notes

Systematic Testing

Testing tasks

  1. build the test harness
  2. generate the test inputs
  3. determine the expected outputs for each of the test inputs
  4. execute the test cases, monitoring the behavior of the program
  5. compare the actual outputs to the expected outputs
  6. evaluate the test results and decide whether the program needs more repair/development

The Test Plan

The test plan (TP) for module M serves as a spec for the test implementation (TM) for M

There are 4 sections to TP:

The Test Implementation

Includes test scaffolding (drivers, stubs, test data files, manual and automated procedures for executing tests).

Here is a sample test driver:

#define QUIT 0
#define S_INIT 1
#define S_PUSH 2
#define S_POP 3
#define G_TOP 4
#define G_DEPTH 5
#define G_DUMP 6

main()
{
  int reply, i;

  while ((reply=nextcall()) != QUIT) {
    switch(reply) {
      case S_INIT:
        ps_s_init();
        break;
      case S_PUSH:
        i = readint("Enter element:");
        ps_s_push(i);
        break;
      case S_POP:
        ps_s_pop();
        break;
      case G_TOP:
        i = ps_g_top();
        printf("returns %d\n",i);
        break;
      case G_DEPTH:
        i = ps_g_depth();
        printf("returns %d\n",i);
        break;
      case G_DUMP:
        ps_g_dump();
        break;
    }
  }
  return(0);
}

Issues

Testing Approaches

System Integration

What is the strategy for combining modules into a testable system?