in reply to Re^3: RFC: Runnable test code integrated into Modules.
in thread RFC: Runnable test code integrated into Modules.

Thanks, that makes sense for me. And let me 'use' your one more time: what do you think about Test::Unit suite? Is it cute?

--dda

  • Comment on Re: Re^3: RFC: Runnable test code integrated into Modules.

Replies are listed 'Best First'.
Re^5: RFC: Runnable test code integrated into Modules.
by adrianh (Chancellor) on Sep 13, 2003 at 14:08 UTC

    I would class it as "cute" - but I wouldn't use it.

    Bias alert. I wrote Test::Class because I wasn't happy Test::Unit. Please read the following with the appropriate grains of salt.

    This is what I said about Test::Unit when I discussed other xUnit frameworks in the Test::Class documentation.

    Test::Unit is a port of JUnit http://www.junit.org/ into perl. If you have used JUnit then the Test::Unit framework should be very familiar.

    It is class based so you can easily reuse your test classes and extend by subclassing. You get a nice flexible framework you can tweak to your heart's content. If you can run Tk you also get a graphical test runner.

    However, Test::Unit is not based on Test::Builder. You cannot easily move Test::Builder based test functions into Test::Unit based classes. You have to learn another test assertion API.

    Test::Unit implements it's own testing framework separate from Test::Harness. You can retrofit *.t scripts as unit tests, and output test results in the format that Test::Harness expects, but things like todo tests and skipping tests are not supported.

    So, for me, I would only recommend Test::Unit if you were really into JUnit and similar. Since it's a direct port of that framework to Perl it will be an instantly familiar environment.

    Because it's a direct port it fails to take full advantage of the existing Perl testing frameworks. It's support for Test::Harness is limited, and its integration with the de-facto standard Test::Builder based modules is non-existent.

    If you need fixtures, test classes, etc. then I would recommend using Test::Class instead - but I would say that wouldn't I :-)