Adding "tags" to Test::Class::Moose
I've been thinking about the idea of adding optional "tags" to Test::Class::Moose, similar in concept to Mark Morgan's Test::Class::Filter::Tags. Here's an example of what that would look like:
sub test_get_profile : Tags(redis network) {
... tests go here
}
What could you do with that? Well, the other day our network went down at work. My test suite blocked because all of the tests which required a network would hang. With the above, I could do this:
Test::Class::Moose->new( exclude => 'network' )->runtests;
And have carried on with my work.
Or maybe you have tests that you know could run in parallel:
sub test_some_unit_test : Tags(parallel) {
... tests go here
}
With that, if someone writes a forking version of Test::Class::Moose, you could automatically pick out all of the tests which can safely run in parallel and the tests which cannot would be run sequentially in another child.
Of course, if you parallelize the tests, it would be nice if you knew how long different test classes and methods ran: it would make it easier to write a scheduler. Oh, that's right, Test::Class::Moose has reporting (and a branch where I'm beefing up the reporting docs).
There's a lot of potential here. I'm currently working on improving the documentation, but I think the abstract should say "test suites for power users". With all of the features it has, it's shaping up into a pretty nifty tool.
If you like this idea, I've added it to play.perl.org.