Open main menu

CDOT Wiki β

Changes

Delta debugging testcase 01

1,812 bytes added, 18:40, 13 December 2006
no edit summary
== Name ==

Hello World Test

== Description ==

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

<pre>
#!/usr/bin/perl

use warnings;
use strict;

print ("Hello world!");
</pre>

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 ==

The test uses '''svn://cdot.senecac.on.ca/deltatest'''.

== 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.
* Run the '''testHello.pl'''. Ensure that the test passes (i.e. fix the error in '''helloworld.pl''').
<pre> perl testHello.pl </pre>
* 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.
<pre>
$ perl testHello.pl
Undefined subroutine &main::prints called at HelloWorld/helloWorld.pl line 6.
hello.log is zero-size.
0
</pre>
* Run the '''deltadebughello.pl'''. The algorithm will then go backward in time and find the revision that passes the test.
<pre> perl deltadebughello.pl </pre>
1
edit