Open main menu

CDOT Wiki β

Delta debugging testcase 01

Name

Hello World Test

Description

This test case runs the famous HelloWorld script written in perl. This is the correct content of helloworld.pl.

#!/usr/bin/perl

use warnings;
use strict;

print ("Hello world!");

The purpose of this test is to purposely wreck HelloWorld (bet you never thought of that!) and let Delta Debugging Algorithm recover the correct version from the SVN.

Repository

Components

HelloBuild.pl

  • Build Script.
  • Since HelloWorld is a Perl file, and Perl combines compilation and execution, the Build Script calls the program and pipes the result to a log file.
  • If the compilation fails, the log file will not be created.

HelloTestCase1.pm

  • Test Module.
  • Tests if the log file exists, and it is not empty. The test fails otherwise.

deltadebughello.pl

  • Delta Debugging Script.
  • Runs the Delta Debugging Algorithm to detect failed test (in this case, compilation error) and perform fixes.

testHello.pl

  • Unit test, runs the build and test the program.

Test Method

  • Download the source code from the repository!. The test can't be run straight from the zipped source code.
 svn checkout svn://cdot.senecac.on.ca/deltatest 
  • Run the testHello.pl. Ensure that the test passes (i.e. fix the error in helloworld.pl).
 perl testHello.pl 
  • Modify helloworld.pl in the HelloWorld directory to induce compilation error (e.g. change print to prints)
  • Run the testHello.pl again. Ensure that the test fails. You may receive this line.
$ perl testHello.pl
Undefined subroutine &main::prints called at HelloWorld/helloWorld.pl line 6.
hello.log is zero-size.
0
  • Run the deltadebughello.pl. The algorithm will then go backward in time and find the revision that passes the test.
 perl deltadebughello.pl