You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Joe Germuska <jo...@germuska.com> on 2003/12/08 22:56:56 UTC
Test Case Exception Throwing style (Re: Cactus tests)
Going further along the quest to get Tomcat tests running in Maven, I
need to ask a style question:
Most or all of the taglib testcases use a pattern where they call a
private method "runMyTest" with some parameters. This method calls
pageContext.forward() to pass control to a JSP where the tags are
actually tested.
A problem I had while trying to get the Cactus tests to run is that
this "runMyTest" method caught an exception from pageContext.forward()
and called the "fail" method. This resulted in the real stack trace
getting printed to STDOUT (amidst output from 100 test cases) and a not
particularly useful message getting placed in the test report.
I would suggest that the proper behavior here is to throw the exception
and let JUnit deal with it as an error rather than a failure. This
puts the actual error in the test report, which makes it a lot easier
to solve the problem.
I've actually implemented this change locally in the test classes to
help me debug the cactus tests. Would anyone object to making these
changes permanent?
For what it's worth, I've got it passing 71/97 tests clear, and the
rest fall into two categories: 19 with failures because the
context-path of the test app is hardcoded as "test" and the plugin uses
"struts-cactus", and 7 that have to do with cookie values. If anyone
has any clever ideas for the simplest way to extract the context path
without using the tags which are being tested, I'm all ears... the
cookie thing is totally baffling at the moment.
Joe
--
Joe Germuska
Joe@Germuska.com
http://blog.germuska.com
"We want beef in dessert if we can get it there."
-- Betty Hogan, Director of New Product Development, National
Cattlemen's Beef Association