5

I get following error message when I tried to run tests in command line.

Tests are based on Geb, Selenium and Cucumber/Groovy.

Caused by: org.gradle.api.GradleException: Could not generate test report to 'D:\Folder\ABCD\Auto\build\reports\tests'.
        at org.gradle.api.internal.tasks.testing.junit.report.DefaultTestReport.generateFiles(DefaultTestReport.java:84)
        at org.gradle.api.internal.tasks.testing.junit.report.DefaultTestReport.generateReport(DefaultTestReport.java:48)
        at org.gradle.api.tasks.testing.Test.executeTests(Test.java:482)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:219)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:212)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:201)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:530)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:513)

Added more error details:

Caused by: java.io.FileNotFoundException: D:\Folder\ABCD\Auto\build\reports\tests\packages\When I enter valid registration details "d2bcons" and "fi rstdtwob" and "lastdtwob" and "d2bcons@trashcanmail.html (The filename, directory name, or volume label syntax is incorrect) 

What could cause the error?

Thanks

Shabar
  • 2,617
  • 11
  • 57
  • 98
  • I don't know how it works on windows but do You have any write permissions to this folder? Are there any permissions required? – Opal Aug 07 '14 at 09:25
  • I noticed that this happens every time tests get failed. I don't have any permission issue. – Shabar Aug 07 '14 at 13:17
  • No idea wht may cause it - hard tp debug. – Opal Aug 07 '14 at 13:19
  • @Opal This time I got the error after passing the tests. After running debug mode I see error as `Caused by: java.io.FileNotFoundException: D:\Folder\ABCD\Auto\build\reports\tests\packages\When I enter valid registration details "d2bcons" and "fi rstdtwob" and "lastdtwob" and "d2bcons@trashcanmail.html (The filename, directory name, or volume label syntax is incorrect) `. May be because my cucumber step name. Its trying to write file name same as step name and getting syntax error. Is there a way to fix this? Error added to the question for more clarity – Shabar Aug 09 '14 at 02:35

2 Answers2

8

After doing some investigations it was turned out that this was due to dot (".") use in the Gherkin file for one of the test steps.

The root cause was when try to generate test report with step name as the file name, it generate this error since it is invalid to have dot in the htlm file apart from the extension dot.

Hope this is clear and helpful.

Shabar
  • 2,617
  • 11
  • 57
  • 98
7

It is possible to provide an argument to Cucumber so that it does not use invalid characters in the filename. On your Cucumber runner class you can add the following argument to the CucumberOptions attribute:

--filename-compatible-names

For example:

@CucumberOptions(junit = {"--filename-compatible-names"})
Tobias M
  • 1,308
  • 3
  • 18
  • 23