There's Test::Simple, Test::More, Test::Builder (all part of the Test::Simple distribution), Test::Class, Test::Unit, Test::Moose...
I'm starting a new project using Moose—which module should I use for writing my tests?
The Comprehensive Perl Archive Network (CPAN) is a repository of over 250,000 software modules and accompanying documentation for 39,000 distributions, written in the Perl programming language by over 12,000 contributors.
1. Write Test Cases with Test::Simple. You can write test cases in perl using the perl Test::Simple module which has the basic functionality for testing. Before proceed to writing test case, first you need to plan the number of test cases and then the actual test cases.
Unit testing in Perl couldn't be easier. You run unit tests just like normal code (e.g., perl MYFILE ). There are just two functions you need to remember: is(EXPERIMENTAL_VALUE, EXPECTED_VALUE, OPTIONAL_MESSAGE)
You can eliminate Test::Builder from the list for a while. Test::Builder is the base module that other Test:: modules are built on. So until you want to start writing your own test modules you won't need it.
I'd also ignore Test::Simple. Test::More does all that Test::Simple does - and plenty more.
Test::Class is a nice way to write unit tests in a really object oriented way. I'd recommend it for complex OO-based systems.
Test::Moose is for testing various Moose-related features in your code. You say that you're using Moose so it might well be useful for you. It can be used in conjunction with Test::More.
So my recommendation would be to start with Test::More and Test::Moose. But also take a look at Test::Class to see if it fits with the way that you want to write tests.
Perl Testing: A Developers Notebook is a great introduction to this topic.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With