ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Wells <chwe...@us.ibm.com>
Subject Enhancing JUnitReport's output
Date Fri, 02 Feb 2007 21:16:16 GMT
I use Ant to invoke several different test suites, where each test suite
contains many test cases, and each test case contains many test methods.
Its a common complaint here that the HTML report generated by the
<junitreport> task lists all the test method names but not what test case
each method belongs to.  This is a problem because it is common to have the
same test method name exist in more than one test case; we can't easily
tell which test method may be the one reporting a failure.  We don't want
to have to incorporate the test case's name in the naming of every test
method; this seems excessive.  Besides, even if we keep all names unique,
it can still be annoying figuring out which test case a particular method
belongs to.  What's the preferred ways that others deal with this problem?
Is there something simple that I'm overlooking?  The only way I found so
far was to write a custom formatter that writes both the test case name and
the test method name when generating the <testcase> tag's "name" attribute
into the XML, rather than just write the test method name.  Is this a
reasonable approach?    (I bet this has been asked before, but my searching
turned up nothing, so my apologies if this is a dup.)

The other issue I have with the format of the HTML is that it groups the
tests by Java package rather than by a name of my choosing.  This is a
problem when I am running the same suite of tests (which would always exist
in the same package) several times, but varying the purpose of the test run
each time.  For example, I may have suite AllTests which I first run
against DB2, next against Oracle, then against SQL Server, and a fourth
time on Unix.  This produces four XML files, one for each run of AllTests.
The <junit> task lets me name these XML files so that they have useful
names that indicate the purpose of the test run, e.g.
"TEST-Oracle-AllTests.xml".  Then, I use <junitreport> task to create a
single HTML noframes report from those 4 XML files.  The report has a
"Packages" section that combines all the test runs into one line.  Next, it
has a Package section that then has "AllTests" repeated several times, with
a summary of each.  What's the best way to get a name of my choosing in
place of "AllTests", such as "Oracle Test Run" or "DB2 Test Run"?  Its not
obvious to me how to best proceed, although I'm guessing it may require
modifying the stylesheet (I don't know XSL... yet).  Anyone have a good
solution for this?

Thanks!


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message