Test::CT - *Mix* of Test::More + Test::Reuse + Test::Routine, with *template* system.
version 0.12
use Test::CT; # get test singleton object my $tester = Test::CT->instance; # add your tests.. this may repeat sometimes in your file. do { my $ref = sub { # your testing code goes here my $user = { name => 'foo' }; ok($user->{name}, 'looks have a name!'); is($user->{name}, 'foo', 'user name is foo'); isnt(1, 0, '1 isnt 0'); $tester->stash->{user} = $user; }; # add this code reference to tests list $tester->add_test( Test::CT::TestFile->new( coderef => $ref, name => 'ct/tests/001-name-you-give.t' ) ); }; # then you can add another test that use $tester->stash->{user} # expecting it to be ok # run the tests! $tester->run( name => 'ct/tests/001-name-you-give.t'); # this will not ran the test again $tester->run( name => 'ct/tests/001-name-you-give.t'); # but you can force it $tester->run( name => 'ct/tests/001-name-you-give.t', force_exec => 1); $tester->run( like => 'name-.+'); # all tests name =~ /name-.+/ $tester->run( llike => 'ct/tests/'); # all tests name =~ /^name-.+/ # TODO $tester->run( like => qr/your regularexpr/);
Please see more in README in https://github.com/renatoaware/Test-CT
Test-CT is a different way to you write your tests files.
Using commands of Test::More, writing separated tests files like Test::Aggregate::Nested and using a stash to keep tracking of all tests for you write a simple (or not) documentation for your project.
Run the coderef of a Test::CT::TestFile
?name => 'string' # find test by name ?like => 'string' # find test by /$like/ ?llike => 'string' # find test by /^$like/ ?force_exec => $boolean # true for execute tests even if already executed before
It's like Catalyst stash. A simple hashref, so you can:
$tester->stash( foo => 1, bar => 2) $tester->stash({ abc => 2}); $tester->stash->{foo}++;
Instantiate all Test::CT::LogWriter::XXX from @{$self->config->{log_writer}} to generate documentation.
Should be called after all tests run.
This is alpha software. But the interface will be stable, and changes will make effort to keep back compatibility, even though major revisions.
Aware - http://www.aware.com.br
Renato Cron <rentocron@cpan.org>
This software is copyright (c) 2013 by Renato Cron.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Test::CT, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::CT
CPAN shell
perl -MCPAN -e shell install Test::CT
For more information on module installation, please visit the detailed CPAN module installation guide.