I am fixing a large script test (> 1000 lines) that uses some utility methods (also> 1000 lines) to run retests with different settings for the source data. This helps consolidate the code. However, when the test fails, it reports the line number inside the utility method, which makes it difficult to track which test failed.
Is it possible to configure Test::Mostthat during the test run not a single line number is executed, but instead
use strict;
use warnings;
use autodie;
use Test::Most tests => 3;
ok(1, 'first test');
note "The following includes a failed test, but a stack trace would be more helpful";
helper_sub_with_test();
ok(1, 'third test');
sub helper_sub_with_test {
ok(0, "second test");
}
Outputs:
$ perl scratch.pl
1..3
ok 1 - first test
not ok 2 - second test
ok 3 - third test
As you can see, it would be useful if the failed test reported both lines 17 and 13, when there are several calls to the utility method.
source
share