On Sun, Sep 27, 2009 at 1:13 PM, Chris Hostetter <[email protected]> wrote: > > : 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 > SLF4J?
All of the above. > : 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. Sweet! Not what I was talking about, but trying to filter malignant from benign exceptions has been a constant thorn in my side. -Yonik http://www.lucidimagination.com
