Cucumber in combination with jUnit-reporting tries to create files with special characters


we have a problem concerning Cucumber (behaviour driven development) in combination with the Gradle jUnit reporting. Cucumber creates jUnit-test-cases with names like “Scenario: Search number of Subscription per category” and the jUnit-reporting of Gradle creates a xml-file with the name of the test-case like “Scenario: Search number of Subscription per category.xml”. Because our TeamCity-server (continuous integration) runs on windows, a file with special characters cannot be written. More precisely: Files with the characters ‘:’ and ‘|’ . (both used by Cucumber)

As soon as our Gradle-task tries to write the xml-file, the test fails with an Error and our tests stop running. [Gradle failure report] > Could not write XML test results for Scenario: Assign roles to the admin to file C:*stuff*\build\test-results\firefoxTest\TEST-Scenario: Assign roles to the admin.xml.

Unfortunately we need that Gradle-jUnit-reporting, because TeamCity depends on this data. I can disable the reporting, but then our task will just say “ok” or “failed” with no detailed information about the number of test-cases, how many failed, etc.

I have also posted this problem in the Cucumber user-group:!topic/cukes/kLIc5NfRllg

All the best, Dominik

Hello Domenik, I think you’re running into GRADLE-2739 which is fixed on master and will be shipped with gradle 1.9. Can you try a latest gradle nightly build from to double check the fix is working for you?

cheers, René

Hi, we have verified the fix (bad tokens in filenames from Cucumber-jvm tests) for the following filename and some variations of it: “TEST-Scenario: Dokumentet är ärendeskapande”

Filename generation (bad token replacement) worked OK for Windows 7, Linux (RHEL 6.3) and Solaris 5.10.

Verified for gradle-1.9-rc-2.

Thanks! /Jonas