Bug 62443 - junitreport: test case with ClassNotFoundException is not added to alltests-errors.html
Summary: junitreport: test case with ClassNotFoundException is not added to alltests-e...
Alias: None
Product: Ant
Classification: Unclassified
Component: Optional Tasks (show other bugs)
Version: 1.10.3
Hardware: PC Mac OS X 10.1
: P2 normal (vote)
Target Milestone: 1.10.4
Assignee: Ant Notifications List
Depends on:
Reported: 2018-06-09 15:27 UTC by Christopher Brooks
Modified: 2018-06-18 14:31 UTC (History)
0 users

Ant junitreport example of ClassNotFoundException test being ignored (10.14 KB, application/x-gzip)
2018-06-09 15:27 UTC, Christopher Brooks

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Brooks 2018-06-09 15:27:56 UTC
Created attachment 35962 [details]
Ant junitreport example of ClassNotFoundException test being ignored

If I have a JUnit test case .xml that has an error of type java.lang.ClassNotFoundException, then the ant junitreport creates a index.html file that lists the error, but alltests-errors.html does not.

I've attached a test case.

Here's a test run


bash-3.2$ ~/src/ant/bin/ant -version
Apache Ant(TM) version 1.10.4alpha compiled on June 8 2018
bash-3.2$ ~/src/ant/bin/ant
Buildfile: /Users/cxh/src/antjunitreport/build.xml

[junitreport] Processing /Users/cxh/src/antjunitreport/reports/TESTS-TestSuites.xml to /var/folders/84/9vvs507x50lb0jnclpqt6sjm0000gp/T/null2055154669
[junitreport] Loading stylesheet jar:file:/Users/cxh/src/ant/lib/ant-junit.jar!/org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-frames.xsl
[junitreport] Transform time: 506ms
[junitreport] Deleting: /var/folders/84/9vvs507x50lb0jnclpqt6sjm0000gp/T/null2055154669

Total time: 0 seconds
bash-3.2$ cat reports/junit/html/alltests-errors.html 
<html xmlns:string="xalan://java.lang.String" xmlns:lxslt="http://xml.apache.org/xslt">
        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Unit Test Results: All Errors</title>
        <link rel="stylesheet" type="text/css" title="Style" href="stylesheet.css">
    <body onload="open('allclasses-frame.html','classListFrame')">
	<h1>Unit Test Results.</h1>
        <table width="100%">
                <td align="left"></td><td align="right">Designed for use with <a href="http://www.junit.org/">JUnit</a> and <a href="http://ant.apache.org/">An\
        <hr size="1">
        <h2>All Errors</h2>
        <table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
            <tr valign="top">
                <th>Class</th><th>Name</th><th>Status</th><th width="80%">Type</th><th nowrap>Time(s)</th>


In the above, I would expect that alltests-errors.html would have a link to /reports/junit/html/0_ClassNotFoundException.html

I'll see about creating a proper test case, but I wanted to document this while I was thinking about it.
Comment 1 Stefan Bodewig 2018-06-16 17:00:55 UTC
In your case there only is an outer testsuite and not a single testcase element. The table of tests only contains the testcases - i.e. the test methods that have been executed as there are none in your case, the table is empty. This happens in the all-tests as well as the alltests-errors HTML pages.

I'll look into handling the case of an error loading a testsuite the same way it would be handled on the testsuite detail page.
Comment 2 Stefan Bodewig 2018-06-16 18:21:51 UTC
should be fixed in Ant's master and 1.9.x branches now, you can try the modified stylesheet by downloading it and setting the styledir attribute.
Comment 3 Christopher Brooks 2018-06-18 14:27:24 UTC
Thanks!  That fixed it.  I agree that was is a somewhat degenerate failure.
Comment 4 Stefan Bodewig 2018-06-18 14:31:01 UTC
Good to hear it worked. We'll likely have a new Ant release pretty soon so the styledir workaround should become obsolete in a few days or weeks.