Cucumber test report file formation is failing in Gradle 1.5

Good day.

I’m attempting to migrate from Gradle 1.3 to Gradle 1.5, and am performing some smoketesting of a CucumberJVM test suite. The Cuke tests appear to boot and run fine. But when it comes time to write the test report file, the process fails with messages like this:

Problems writing to file: /Users/petrovic/Projects/xoom/qa/prod/cucumber-jvm-test/build/test-results/binary/intTest/Scenario: FX cache clearing for /fx endpoint.stdout

where in the Scenario file we have

Scenario: FX cache clearing for /fx endpoint

Anyone have an idea of how I can fix this? I wanted to migrate from 1.3 to 1.4 when 1.4 came out, but the Cuke tests failed to even start. Hence my wait for 1.5.

Thanks.

Any chance you could supply a sample project?

Seems like a simple escaping issue. Having a sample project will help us verify the fix quicker.

Thanks, Luke.

This project reproduces the effect when you use the wrapper (ignore the 14 in the repo name):

https://github.com/ae6rt/cucumberjvm-gradle14.git

Confirmed, raised as GRADLE-2739.

@Mark: would you mind branching that repo at that point so we can use that as a reference?

Sure, here you go:

https://github.com/ae6rt/cucumberjvm-gradle14/tree/gradleware_reference

If I had a hint on where to look for the lines of code to fix, I can take a look at this in the next couple days.

[edited]

I found where the exception is thrown, but as I refresh my memory on the failure mode, I note that the root cause of the problem is an NPE:

aused by: org.gradle.api.GradleException: Could not write XML test results for Scenario: Say goodbye

to file /Users/petrovic/Projects/cucumberjvm-gradle14/build/test-results/TEST-Scenario: Say goodbye

.xml.

at org.gradle.api.internal.tasks.testing.junit.result.Binary2JUnitXmlReportGenerator$1.execute(Binary2JUnitXmlReportGenerator.java:57)

at org.gradle.api.internal.tasks.testing.junit.result.Binary2JUnitXmlReportGenerator$1.execute(Binary2JUnitXmlReportGenerator.java:48)

at org.gradle.api.internal.tasks.testing.junit.result.TestReportDataCollector.visitClasses(TestReportDataCollector.java:95)

at org.gradle.api.internal.tasks.testing.junit.result.Binary2JUnitXmlReportGenerator.generate(Binary2JUnitXmlReportGenerator.java:48)

at org.gradle.api.tasks.testing.Test.executeTests(Test.java:455)

at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:216)

at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:122)

at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:147)

at org.gradle.api.tasks.testing.Test_Decorated.invokeMethod(Unknown Source)

at org.gradle.util.ReflectionUtil.invoke(ReflectionUtil.groovy:23)

at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:217)

at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:210)

at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:199)

at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:527)

at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:510)

at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)

at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)

… 80 more Caused by: java.lang.NullPointerException

at org.gradle.api.internal.xml.SimpleMarkupWriter.writeXmlAttributeEncoded(SimpleMarkupWriter.java:372)

at org.gradle.api.internal.xml.SimpleMarkupWriter.attribute(SimpleMarkupWriter.java:241)

at org.gradle.api.internal.tasks.testing.junit.result.JUnitXmlResultWriter.writeTests(JUnitXmlResultWriter.java:83)

at org.gradle.api.internal.tasks.testing.junit.result.JUnitXmlResultWriter.write(JUnitXmlResultWriter.java:60)

at org.gradle.api.internal.tasks.testing.junit.result.Binary2JUnitXmlReportGenerator$1.execute(Binary2JUnitXmlReportGenerator.java:54)

… 96 more

and not a filename-escaping issue.

I’m seeing the same issue when building gvm, so currently stuck on 1.3 too.

In v1.7, I believe you’ll be able to disable this reporting so the Cucumber test suite will run to completion.

I confirm it is fixed in the last nigthly using:

test {

reports.html.enabled = false

reports.junitXml.enabled = false

}

It seems like my issue is more closely related to http://issues.gradle.org/browse/GRADLE-2765

Any ideas when Gradle 1.7 rc releases will be made available?

The DSL docs for latest-nightly gradle-1.8-20130628001807+0000-all.zip say test.reports is read-only. I must be misinterpreting the doc. Hmm.

The reports property is read only, but the reports object is mutable.

This week.

Maybe it would be helpful to add it to the 1.7 doc about test reporting? http://www.gradle.org/docs/1.7-rc-1/userguide/java_plugin.html#test_reporting