I built a patch for a couple of modules and found myself having to go through and renumber all the testcases after the position I inserted my test.
Then that module has a pretty darn odd way of doing test cases. I've never had to explicitly number a test. There isn't even an API for explicit test numbers in Test::Builder!
More recently I tried to track down the source of a failure reported as "Hmmm. Looks like test 27 failed", or similar and found myself having to plod through the test file counting manually to work out which was test 27. Less than easy as the were a lot of tests commented out.
Either way, a line number of the failing testcase, and a traceback to the point of failure would be a lot more useful.
Good test descriptions help with this and any standard Test::Builder based module will report the line number of the failing test case.
#! /usr/bin/perl use strict; use warnings; use Test::More 'no_plan'; is 1+1, 2, 'addition works'; is 2*2, 5, 'oops - silly me'; __END__ # outputs ok 1 - addition works not ok 2 - oops - silly me # Failed test 'oops - silly me' # in foo.t at line 8. # got: '4' # expected: '5' 1..2
In reply to Re^13: Self Testing Modules
by adrianh
in thread Self Testing Modules
by Sheol
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |