Subject: | Feature Request (Obtaining failed test information when runtests is done) |
Date: | Wed, 24 Nov 2004 13:16:47 -0500 |
From: | "Potozniak, Andrew" <acs1.acp7 [...] ubitmail.buffalo.edu> |
To: | <bug-test-harness [...] rt.cpan.org> |
It would be nice to obtain a list of tests that failed including: the
number of the test, the text of the test, the expected value, actual
value, and the file the test was from after the Test::Harness is done
running the tests you had it run. For example:
use Test::Harness;
my @tests = ('test1.t', 'test2.t', 'test3.t', 'test4.t', 'test5.t',
'test6.t', 'test7.t');
&Test::Harness::runtests(@tests);
#Where results is a hash of the tests that were run if they passed,
expected value, actual value, file the test was in, the number of the
test, etc
my %results = %{Test::Harness::getResults()};
#Then one can go through the hash and get the information they want and
report it to the screen.
#Or you could even write something along the lines of:
my %failed_tests = %{Test::Harness::getFailedTests()};
#Which would do the same as getReuslts but only return the tests that
failed.
#The hash structure could be like the following:
#%results = ( <filename.t> => { passed => true|false,
# test_text => string,
# etc.}
# );