lucene-solr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: print junit test name
Date Sun, 27 Sep 2009 17:13:55 GMT

: Right now, if I see something funny (like an exception that doesn't
: cause a test failure) in a big junit test report, it's hard to tell
: what test it was in - the output for each test is simply catenated,
: with no separator.

what do you mean by output?  System.out? System.err? messages logged via 

: Is there a way to get junit to print this info, or do we need to do
: subclass TestCase, and do it ourselves?

getName() can be called by any method in a testCase at anytime to know 
which test method is currently being executed (or in the case of 
setUp/tearDown about to be executed) so we could always modify 
AbstractSolrTestCase to print that out in setUp/tearDown

if you're specificly talking about exceptions that get writen via the 
logger then the ideal solution is something i've been meaning to look into 
when i have some more time: a LogHandler dynamicly registered during 
setUp() that records any log messages above a certain level (ERROR) that 
test methods can use to assert that certain behavior did/didn't trigger 
messages matching a regex (ie: tests of bad config/input that want to 
assert an error was logged vs test of good configs/input that assert no 
errors were logged)  the tearDown method can then assert that the 
LogHandler doesn't have any LogMessages left in it's queue the test didn't 
already account for.


View raw message