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

I am writing some modules and using Test::Class to hold my tests. In my distribution I am putting the module in /lib/Foo/Bar.pm and the test modules in /lib/Test/Foo/Bar.pm .

However I was justing thinking, when I go to install the distribution, do I really want to install my test modules? Does anyone have any ideas? I am using Module::Build as my distribution installer.

Replies are listed 'Best First'.
Re: Test::Class modules, skip install
by dragonchild (Archbishop) on Jun 05, 2006 at 17:23 UTC
    Your test modules should go into t/lib/Test/Foo/Bar.pm and you should do a "use lib 't/lib'" in your .t files. That avoids the problem completely.

    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
      Your test modules should go into t/lib/Test/Foo/Bar.pm and you should do a "use lib 't/lib'" in your .t files

      s/should/can/ - installing test modules can be a good thing if they can be useful for people sub-classing your code.

        People subclassing your code should look at your distribution for how to test it. In that case, they'll find your test classes.

        My criteria for good software:
        1. Does it work?
        2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
      That is a pretty cool idea, thanks! :)

      dragonchild wrote test modules should go into t/lib/Test/Foo/Bar.pm.

      In the "better late than never" category, I figured I should mention a slight problem with this. That path should actually be something like t/lib/Tests to avoid potential conflicts with the the Test:: namespace. I speak from painful experience when I named a base testing class Test::Base.

      Cheers,
      Ovid

      New address of my CGI Course.

Re: Test::Class modules, skip install
by Old_Gray_Bear (Bishop) on Jun 05, 2006 at 17:32 UTC
    Personally, I like modules that install Test Kits. It gives me the feeling that the Developer cares about the quality of the product. Also, it gives me a starting place to find code-snippets (over and above the Examples tab in the POD).

    ----
    I Go Back to Sleep, Now.

    OGB

Re: Test::Class modules, skip install
by chromatic (Archbishop) on Jun 06, 2006 at 00:31 UTC

    If you intend that anyone should ever subclass your modules, install the test modules. It makes their lives easier.

Re: Test::Class modules, skip install
by UnderMine (Friar) on Jun 05, 2006 at 22:20 UTC
    If you have a test suite you should use it or at least a sub set of it with you package.

    Regression testing allows you to discover problems at the earliest possible stage. You module may depend on another that has an interface change in a later version. Without including the tests you are relying on the interfaces you use to be backward compatible. Fixing this is a nightmare without a set of tests that show up interface issues.

    Just my thoughts
    UnderMine

      It is one thing to have a test suite as part of a package, is another to just be installing tests as regular modules. The point is that in this instance I really don't see a need to install my tests with my package.