Cucumber tests fails when run with Gradle test task. (Gradle 1.4)
karaaie opened this issue · 7 comments
Hello, I'm experiencing some problems when I try to run Cucumber-jvm tests. The file RunCukesTest is annotated with @RunWith(Cucumber.class). It can be seen below.
- What went wrong:
Execution failed for task ':test'.Could not write XML test results for com.assaabloy.stg.a3p.acceptancetests.RunCukesTest to file C:\Dev\Jobb\arx_trunk\server-rt\AccteptanceTests\build\test-results\TEST-com.assaabloy.stg.a3p.acceptancetests.RunCukesTest.xml.
Also I've been able to verify that the tests run and succeed in Intellij. In my quest to solve this on my own I checked out the gradle source code and ran som debugging on my own. I managed to narrow it down to that when writing the xml-report file the last test doesn't have a name which makes the method write in the class JUnitXmlResultWriter at the row .attribute("name", methodResult.getName()) throw a null pointer.
The test suite reports 4 tests for a scenario with three steps in it:
Scenario: Blabha lba
Given: assdf
When: aslkdfj
Then: asdf
The given, when and then steps succeed and have a name, but then a fourth TestMethodResult is added which I belive is the conclusion of the scenario and that one lacks a name.
I'm not sure if this is a bug with Gradle test which can't handle test methods with null names or if this is a problem with cucumber-jvm, thus I'll post this here and also on the gradle issue tracker.
Best regards, Kamil
This seems to be an issue with how cucumbers junitreporter works, http://forums.gradle.org/gradle/topics/beforetest_descriptor_is_null_and_the_test_is_not_actually_run_trying_to_run_groovy_and_java_cucumber_step_definition
Is this something that will receive attention by the cucumber-jvm developers, or is my best bet to fork this project and fix it myself ?
What Cucumber-JVM version?
It's version 1.1.2, perhaps there is a snaphot for 1.1.3 available?
This seems to solve the problem with gradle (tested on 1.5):
https://github.com/philstyler/cucumber-jvm/commits/gradle_compatibility
What do you think?
Edit: There still seem to be some issues with the test report generation. The HTML report index page lists the cucumber tests only when at least one test failed. The page for the default-package always lists the results.
Maybe the root cause is calling testStart testStart testFinish testFinish events instead of always pairing them.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week if no further activity occurs.
This issue has been automatically closed because of inactivity. You can support the Cucumber core team on opencollective
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.