On Tue, Jun 23, 2009 at 04:07:55PM -0400, Michael G Schwern wrote: > is_passing() > ------------ > > As a side effect of this work, there is finally a way to tell if a test is > currently passing. Test::Builder->is_passing(). Its really "have I failed > yet", but if you don't think about it too hard is_passing() makes sense. The > name is up in the air. failed_yet() is one idea which returns the number of > tests which have failed (or violated the plan).
FYI, I'd have found a failed_yet(), and subtests, very useful recently. The NYTProf tests run each test 8 times with various combinations of options (set via the NYTPROF env var). Sometimes it's hard to tell if a failure is related to certain combinations. So I added this quick hack to NYTProf's test library: sub count_of_failed_tests { my @details = Test::Builder->new->details; return scalar grep { not $_->{ok} } @details; } and used it to produce this kind of report: # Test failures of test21-streval3 related to settings: # compress: 0 => {fail 1,pass 7}, 1 => {pass 8} # leave: 0 => {pass 8}, 1 => {fail 1,pass 7} # savesrc: 0 => {pass 8}, 1 => {fail 1,pass 7} # use_db_sub: 0 => {pass 8}, 1 => {fail 1,pass 7} (In this case the issue wasn't directly related to the settings but simply a side effect of the virtual machine being very slow http://www.nntp.perl.org/group/perl.cpan.testers/2009/06/msg4227689.html) So count this as a vote for $count_of_failures = $b->failed_yet(); Tim.