A feature Test::Most probably won't get

I often see this at the top of tests:

use Test::More;
if (not $ENV{TEST_AUTHOR}) {
    plan skip_all => 'Set TEST_AUTHOR to run this test';
}
plan tests => $num_tests;

In fact, I see that so often I thought about adding support for this in Test::Most.

use Test::Most tests => $num_tests, 'author';

That would have done the same thing, but Eric Wilhelm convinced me it was a bad idea. Basically, if you have author tests, put them in $module_dir/xt/author/ instead of in your regular test directory. Why? You don't have author tests run mysteriously because someone else has set that environment variable: you have to explicitly say "run my author tests". You are less likely to worry about people reporting spurious failures because they didn't have a development module installed. Why would you want to worry about those? Just use $module_dir/xt/author/ and it's a non-issue.

By further standardizing how we set up our test infrastructure, we lessen the cognitive load developers have to worry about and this is a good thing.

However, I'm willing to hear counter-arguments. Is "author" pushing too much into Test::Most or is it one of those delightful little tools you would appreciate?

1 Comment

The simplicity of xt/author/ directory makes the 'author' in Test::Most look overkill, IMHO.

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/