I have to design unit tests for large OO application (yes, next time we will create tests before coding). But which is the best way to organize tests?
In the Test::Unit distribution I saw 't' directory with 'head' scripts (all_tests.t, assert.t) and 'tlib' directory with nested class directories.
I have found also an application that uses Test::Unit - it is Rui - Remote User Interface (http://www.cortext.co.il). I downloaded it and saw another approach: each class directory has 'tests' subdirectory, which contains AllTests.pm file looking like this:
use Test::Unit::TestSuite;
use Rui::Event::tests::AllTests; use Rui::Model::tests::AllTests; use Rui::Widget::tests::AllTests; use Rui::View::tests::AllTests;
sub new { bless {}, shift }
sub suite {
my $suite = Test::Unit::TestSuite->empty_new("Rui");
$suite->add_test(Rui::Event::tests::AllTests->suite);
$suite->add_test(Rui::Model::tests::AllTests->suite);
$suite->add_test(Rui::Widget::tests::AllTests->suite);
$suite->add_test(Rui::View::tests::AllTests->suite);
return $suite;
}Thus, it adds tests for child classes, and they may add more child tests as well. Then all tests are called by runing
use Test::Unit::TestRunner; my $testrunner = Test::Unit::TestRunner->new; $testrunner->start(@ARGV);
, where @ARGV is tests::AllTests, forr example.
Do you see any drawbacks of this approach? Can you recommend other sample material available on the Net?
Thanks. -- Dmitry
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Perlunit-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/perlunit-users
