Tags now available with Test::Class::Moose

Side note: Why did I miss that last Perl QA-Hackathon? I've attended every one since they started ... except for the last one. I missed it because the damned French government can't get around to reissuing my damned visa, despite the fact that they're legally required to. I've also had to pass on some business opportunities and a trip Romania. /me is very unhappy with France right now.

So I've finally gotten around to updating Test::Class::Moose to have tags. You can read my previous post when I explain why they're useful. You can go out to github and grab it now, or wait a bit for it to hit your favorite CPAN mirror.

The constructor is very straightforward. For the case I previously described when the network went down? Skip test methods with a network tag!

    exclude_tags => 'network', # scalar or arrayref of tags

Or maybe you want to run your Big Data and API tests, but skip deprecated methods:

    include_tags => [qw/bigdata api/],
    exclude_tags => 'deprecated',

This should solve a common issue where people want to attach metadata to their test suite but there's no clean support for it.

Unfortunately, this was implemented with Sub::Attribute. That's a fantastic module, but it's an optional dependency that some don't want. I had to use that module, though, because there's a little-known edge case where subroutine attributes won't fire if the module was loaded via "eval". I might try another swing at fixing this in the future (via require and a path in Test::Class::Moose::Load?), but for now, if you can't load Sub::Attribute, a warning will be issued and your tag filters will be ignored.

Patches welcome for improving this feature (there are many things which can be done here), but for now, this is the last major piece really needed to make this the goto module for many large test suites.

Leave a comment

About Ovid

user-pic Freelance Perl/Testing/Agile consultant and trainer. See http://www.allaroundtheworld.fr/ for our services. If you have a problem with Perl, we will solve it for you. And don't forget to buy my book! http://www.amazon.com/Beginning-Perl-Curtis-Poe/dp/1118013840/