Failed to create test report in gradle due to cucumber step syntax
I am getting the following error when I try to run tests on the 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 additional 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 be causing the error?
thank
source to share
After some research, it turned out that this was due to the use dot (".")
in the Gherkin file for one of the testing steps.
The main reason was trying to generate a test report with the step name as the file name, it generates this error as it is not allowed to have a point in a file htlm
separate from an extension point.
Hope this is clear and helpful.
source to share
You can provide a Cucumber argument so that it does not use invalid characters in the file name. In the Runner Cucumber class, you can add the following attribute to the CucumberOptions attribute:
- filename-compatible names-
For example:
@CucumberOptions(junit = {"--filename-compatible-names"})
source to share