Saladino has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks, I am preparing a set of tests (multiple tests inside multiple .t files) and i'll like to be able to reorder those tests.
At this moment i execute "prove -r" from the top directory and inside that dir i have several numeric dirs 00 01 02.... and inside that dirs *.t files.
My problem is that as I need external files in some of the tests i have to put the full path from the top dir, for example "03/file1.xml" and that way i cant reorder my tests just changing their dir names or using symbolic links.
Any idea that could help me?
Thanks

Replies are listed 'Best First'.
Re: prove, Test::More and path
by jasonk (Parson) on Nov 08, 2007 at 17:29 UTC

    This is how I do it...

    use Test::More tests => 2; use File::Spec::Functions qw( splitdir catfile ); my @dirs = splitdir( $0 ); pop( @dirs ); # remove the filename my $data_file = catfile( @dirs, 'file1.xml' );

    By basing the path off of $0, it's always relative to the test itself.


    We're not surrounded, we're in a target-rich environment!