Coding Bootcamp: Testing theory

Definition

Dynamic verification that the program has the
expected behevior
in a suitably selected final set of test cases

(Others also consider static analysis as a testing activity.)

Terminology

Levels of testing

Testing by goal

Useful testing techniques

Useful testing data

Judging testing progress

Testing practices

Testing activities

Testing tools

Example: Test coverage analysis with gcov

      1    if (*++argv && !strcmp(*argv, "-n")) {
 ######            ++argv;
 ######            nflag = 1;
           }
           else
      1            nflag = 0;
      3    while (*argv) {
      2            (void)printf("%s", *argv);
      2            if (*++argv)
      1                    putchar(' ');
           }
      1    if (!nflag)
      1            putchar('\n');
      1    exit(0);

Example: Statement coverage (Perl)

Perl statement coverage

Example: Branch coverage (Perl)

Perl branch coverage


Creative Commons Licence
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.