Re: [Perlunit-users] Test::Unit::TestCase->list_tests order, database testing, Re: @TESTS bug
Status: Beta
Brought to you by:
mca1001
From: Jean-Louis L. <jl...@so...> - 2004-10-27 20:49:25
|
> I'm tempted to cross-post to perlunit-devel... maybe you could reply > about the patch/refactor to devel, and discuss the actual use of > decoupled test cases on user? Ok, I'll post to perlunit-devel soon. As for actual use and other non-codish issues, please read on. > In the general case it makes sense to shuffle the order of the tests > methods: AIUI the design intention is that tests should be independent > of each other. My attention was first attracted to this issue because a colleague of mine dismissed PerlUnit for that reason four years ago. I wanted to know the full story. I quickly found out about @TESTS, then realized it didn't work. After doing some reading on junit.org, I accept the theoretical reasons against ordering in the context of xUnit. However there are *practical* reasons why you would want to. For example, some tests may take a much longer time to run. And for what I plan to use PerlUnit for, this is a very real concern. The test method execution time may vary between hours, days and even weeks. So I want to run the 'short' tests first, and either terminate the suite or start analysis of failed short tests while the longer ones are still running. >> If I take the time to make a proper patch, will it be incorporated >> and will a new version be released? > > Yes and no. We will happily accept patches, and future releases will > happen at some point. I'm happy enough if my changes, provided they are accepted, make it into the repository. > More importantly for your patch, I think the fix should either be to > the documentation, or a wider change to the code. Will you stay for a > chat before leaving your patch? 8-) I'm evaluating test harnesses for a customer. I had some concerns which are addresse by the content of your reply, how quick it came, indeed that any reply came at all ;-) And then I need a harness for a product my company is developing on its own. So if I decide to go with PerlUnit, it's likely to be a long-term relationship... > The JUnit guys discuss test execution order starting at > http://groups.yahoo.com/group/junit/message/4063 > > and ending with a removal of the OP's need to fix order at > http://groups.yahoo.com/group/junit/message/4068 Thanks for the pointer. BTW, there seems to be differences between PerlUnit and JUnit. As far as I can see right now I can't duplicate this code from the aforementioned thread (http://groups.yahoo.com/group/junit/message/4065): public class MyTestCase extends TestCase { public static Test suite() { final TestSuite suite = new TestSuite(); suite.addTest(new MyTestCase("myTestMethod1")); suite.addTest(new MyTestCase("myTestMethod2")); suite.addTest(new MyTestCase("myTestMethod3")); suite.addTest(new MyTestCase("myTestMethod4")); } } ...would (naively) translate to: my $suite = Test::Unit::TestSuite->new; $suite->add_test(FooBar->new('test_foo')); my $testrunner = Test::Unit::TestRunner->new(); $testrunner->start($suite); ...but this results in: Couldn't load Test::Unit::TestSuite=HASH(0x86d2668) in any of the supported ways at /usr/lib/perl5/site_perl/5.8.3/Test/Unit/Loader.pm line 68. -- Jean-Louis Leroy Sound Object Logic http://www.soundobjectlogic.com |