Inca::Reporter::SimpleUnit - Module for creating simple unit reporters
use Inca::Reporter::SimpleUnit; my $reporter = new Inca::Reporter::SimpleUnit( name => 'Reporter Name', version => 0.1, description => 'A really helpful reporter description', url => 'http://url.to.more.reporter.info' unit_name => 'What this reporter tests' );
This module is a subclass of Inca::Reporter that provides convenience methods for testing the successful operation of a software package. If the test completes, the report body contains
<unitTest> <ID>unitX</ID> </unitTest>
Otherwise, the exit_status of the report is set to false.
Class constructor which returns a new Inca::Reporter::SimpleUnit object. The constructor supports the following parameter in addition to those supported by Inca::Reporter.
the name of the unit being tested; default ''.
Return the name of the unit being tested.
Constructs and returns the body of the reporter.
Set the name of the unit being tested to $name.
Sets the result of this unit test to be failed with failure message $msg.
Sets the result of this unit test to be successful.
my $reporter = new Inca::Reporter::SimpleUnit( name => 'grid.resource_management.gram.unit.auth', version => 1.0, description => 'Verifies user can authenticate to gatekeeper', url => 'http://www.ncsa.uiuc.edu/People/jbasney', unit_name => 'authenticate' ); $reporter->addArg('site', 'target site for authentication'); $reporter->processArgv(@ARGV); my $site = $reporter->argValue('site'); my $output = $reporter->loggedCommand("globusrun -a -r $site"); if($output =~ /GRAM Authentication reporter successful/)) { $reporter->unitSuccess(); } else { $reporter->unitFail($output); } $reporter->print(); my $reporter = new Inca::Reporter::SimpleUnit( name => 'runCProgram', version => 1.0, description => 'Verifies a C program can be compiled and run', url => 'http://www.makebelieve.org', unit_name => 'runCProgramTest' ); $reporter->processArgv(@ARGV); # run make if($success) { $reporter->log('info', "make completed in $seconds seconds"); } else { $reporter->unitFail('compile failed'); } # check filesize of input file if($success) { $reporter->log('info', "filesize is $bytes bytes"); # check permissions $reporter->log('warn', 'file is group writeable'); } else { $reporter->unitFail('compile failed'); } # run program if($success) { $reporter->unitSuccess(); } else { $reporter->unitFail($output); } $reporter->print();
Shava Smallen <ssmallen@sdsc.edu>