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

Monks,

How do I break up my unit tests (*.t) into different folders?

The idea being that I could have a folder structure like this:
My-Module-0.001/ t/ /01.basic 01.t 02.t ... nn.t /02.foo 01.t 02.t ... nn.t ... /lib /sbin ...
Is there something special I need to add to my Makefile.PL to have it descend through the various folders? Right now it only finds the tests at the top level in the "t" folder.

Replies are listed 'Best First'.
Re: Test::Simple tests in multiple folders?
by moritz (Cardinal) on Sep 09, 2008 at 18:58 UTC
    If you use Module::Build to generate the Makefile.PL, this section from the documentation is relevant for you:
    If the "recursive_test_files" property is true, then the "t/" directory will be scanned recursively for "*.t" files.

    If not, what build system do you use?

    Update: ExtUtils::MakeMaker has this in the documentation:

    Additional lowercase attributes
    ...
    test {TESTS => 't/*.t'}

    I guess this is the place where you start to experiment, perhaps 't/*.t t/*/*.t' does what you want.

      I've tested it and that works
      C:\temp>nmake test Microsoft (R) Program Maintenance Utility Version 1.50 Copyright (c) Microsoft Corp 1988-94. All rights reserved. C:\Perl\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_harn +ess(0, 'blib\lib', 'blib\arch')" t/*.t t/*/*.t t/T-S-T.......ok t/t09/0901....ok All tests successful. Files=2, Tests=2, 0 wallclock secs ( 0.00 cusr + 0.00 csys = 0.00 C +PU)
      If not, what build system do you use?
      I use ExtUtils::MakeMaker.

      Thanks for the tip - I'll look into it.