On Sat, Oct 04, 2003 at 10:06:19AM +0400, Dmitry Diskin wrote:

> I read from TestCase.pm POD that one can populate @TESTS array in
> order to specify the desired order of tests execution:

Ah, I started at the bottom of my inbox and worked back...  why does
it matter what order the tests run?  The xUnit idea is that each test
(and its associated setup/teardown) should stand alone.


> ### quote begin
> 
> If you need to specify the test order, you can do one of the
> following:
> 
> =over 4
> 
> =item * Set @TESTS
> 
>   our @TESTS = qw(my_test my_test_2);
> 
> This is the simplest, and recommended way.
> 
> ### quote end

> But the above does not work for me. I can include only desired tests
> using @TESTS, but they are listed and executed in a random order,

Hmm, that comment seems to be out of date.  @TESTS is piled into a
hash, then the keys are listed as you said.

> I decided to override list_tests method like this:
> 
> sub list_tests {
>     my $self = shift;
>     return sort $self->SUPER::list_tests(@_);
> }

That would do it, yes.  Did you see in Test/Unit/TestCase.pm,

  # Returns a list of the tests run by this class and its superclasses.
  # DO NOT OVERRIDE THIS UNLESS YOU KNOW WHAT YOU ARE DOING!
  sub list_tests {
      ...

Maybe that comment could be more helpful...  8-/

> It works as expected. What do you think? Am I missing something?

Well it could be that you are missing something.  If you try to avoid
using side effects from each test, then the order should not matter.

I suppose one day the tests may be run in parallel.  That would be
neat, and it would also be incompatible with explicit test ordering.


Matthew  #8-)


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
Perlunit-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/perlunit-users

Reply via email to