http://qs321.pair.com?node_id=537441

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

I currently work on developing a new product that will consist of different components written in several languages. I want to be able to write tests for these components (accessing them as COM servers, DLLs, ...) and use the Perl testing framework to create my own test framework.

I have looked at Test::Unit and Test:Class. Does anybody have any experience with these? What are other people using to create tests for complete software suites (as opposed to tests for just one module)? Are there any solutions for creating HTML reports (overview of failed tests, etc.)? Please share your experiences!

Replies are listed 'Best First'.
Re: Testing framework in Perl
by adrianh (Chancellor) on Mar 17, 2006 at 12:33 UTC
    I have looked at Test::Unit and Test:Class. Does anybody have any experience with these?

    Yes (I wrote the latter :-)

    What are other people using to create tests for complete software suites (as opposed to tests for just one module)?

    Combinations of Module::Build, Test::Class, Test::Builder, Test::Harness::Straps and associated modules.

    Are there any solutions for creating HTML reports (overview of failed tests, etc.)? Please share your experiences!

    Take a look at Test::TAP::HTMLMatrix.

Re: Testing framework in Perl
by davorg (Chancellor) on Mar 17, 2006 at 12:31 UTC

    If you are used to other xUnit testing frameworks (e.g. JUnit) then you will find that Test::Unit is a pretty good port of those frameworks into Perl. The downside, however, is that is doesn't play well with the rest of the Perl testing framework. If you want to make use of the many useful testing modules on CPAN then Test::Class is the way to go.

    And I strongly recommend that you get a copy of Perl Testing: A Developer's Notebook.

    --
    <http://dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

      If you are used to other xUnit testing frameworks (e.g. JUnit) then you will find that Test::Unit is a pretty good port of those frameworks into Perl.

      Actually with the new version of JUnit and TestNG the gap isn't as wide as it was before... I must rewrite that section of the docs at some point :-)

Re: Testing framework in Perl
by timos (Beadle) on Mar 17, 2006 at 12:32 UTC
    I like Test::More. It is very easy to understand, yet powerfull. Just have a look at http://search.cpan.org/~mschwern/Test-Simple-0.62/lib/Test/More.pm

    Regards,
    Timo
Re: Testing framework in Perl
by lima1 (Curate) on Mar 17, 2006 at 12:36 UTC
    Don't know how modular your project is.

    I think it does not matter if it is just one module or if it consists of many components if you choose a good OO design.

    I write tests for every class/module with the standard tool for the language (Test::More on Perl,JUnit for Java,...) because they are well documented (good for other developers) and mature.

    for example if Java component X does the main calculations and Perl Module Y uses some of this Java libs, then test in X with JUnit that the calculations are correct and in Y with Test::More that the communication is ok.