[GRADLE-365] Running "gradle test" twice in a row produces a bogus warning: [ant:junitreport] the file TESTS-TestSuites.xml is not a valid testsuite XML document Created: 21/Jan/09  Updated: 04/Jan/13  Resolved: 23/Feb/09

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: 0.6

Type: Bug
Reporter: Jon Cox Assignee: Tom Eyckmans
Resolution: Fixed Votes: 0

Attachments: Text File GRADLE-365-alternate.patch     Text File GRADLE-365-updated-alternative.patch    


If you have a java project that uses junit and you execute "gradle test" twice in a row
without any intervening call to 'clean' , then ant:junitreport complains that

TESTS-TestSuites.xml file is not a valide testsuite XML document

The first time though, everything runs fine, with no warning.

After tracking this down, it seems that the problem is on line 71 of


In 0.5.2, it says:

fileset(dir: testResultsDir.absolutePath, includes: '*.xml')

Instead, I think it should probably say:

fileset(dir: testResultsDir.absolutePath, includes: '*.xml', excludes: 'TESTS-TestSuites.xml')

What I think is happening is that junitreport creates the TESTS-TestSuites.xml file on the
first execution, then sucks it in on the second, which is naughty.

I made this change on my own & things seem to work; that said, I'll leave it to someone else to
commit a change like this – I'm just coming back to gradle & don't have my sea legs yet.

The reason I kept this at 'major' is that I consider build-noise like this very dangerous
because it tends to obscure real problems and/or foster the "slum effect" when it comes
to warnings.

Incidentally, I checked off "patch submitted" in JIRA, but it's really just the 1-liner above.

Thanks again for Gradle!

Comment by Jon Cox [ 25/Jan/09 ]

Patch for bug: GRADLE-365

Comment by Jon Cox [ 25/Jan/09 ]

Ok, I felt guilty not submitting an actual patch for trunk,
so here it is (see file attached).

Comment by Hans Dockter [ 26/Jan/09 ]

I also hate build noise. Thanks for the patch. I will assign this to Tom, as he is refactoring the test tasks (e.g. testng support).

Comment by Steve Appling [ 13/Feb/09 ]

I happened to also track this down and make a patch before I saw that one had already been submitted. I chose to restrict the includes to the correct files instead of adding an excludes:
fileset(dir: testResultsDir.absolutePath, includes: 'TEST-*.xml')

This seems to correspond to the usage I have seen of junitreport in ant (and in the ant documentation examples).
I'll attach another patch as GRADLE-365-alternate.patch

Comment by Steve Appling [ 13/Feb/09 ]

Alternate fix for GRADLE-365 issue

Comment by Jon Cox [ 17/Feb/09 ]


I like your patch better.


  • Jon
Comment by Jon Cox [ 17/Feb/09 ]

This is an updated version of the patch Steve posted;
it's been modified so that it patches cleanly to SVN REV 1236.

Comment by Tom Eyckmans [ 23/Feb/09 ]

Hi all,

I was annoyed by the warning myself, I've opted for the includes 'TEST-*.xml' as this is the most simple form to get it right .



Generated at Wed Jun 30 11:28:17 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.