Reputation: 193
Trying to run Cucumber with Serenity using JUnit 5.
When the Test Runner has a @RunWith(Cucumber.class)
annotation, the tests run, although Serenity does not record the outcome.
When the Test Runner has @RunWith(CucumberWithSerenity.class)
, a "NoClassDefFound cucumber/runtime/junit/Assertions" is thrown.
I thought it may be JUnit 5, so I switched to JUnit 4 and the same outcome happens.
I loaded the sample project into GitHub: https://github.com/WB3Tech/Cucumber-Serenity-JUnit5
The goal is to build the project then be able to see the Cucumber results in the Serenity html output.
Anyone have an idea of where I may be going wrong?
Upvotes: 1
Views: 3320
Reputation: 942
See https://github.com/serenity-bdd/serenity-core/#cucumber-4. I expect Serenity will only work with JUnit 5 in vintage mode.
Upvotes: 1
Reputation: 193
There were two separate issues:
I was using v4.7.1. When I rolled back to 4.2.0 from 4.7.1, the NoClassDefFound error went away. When I bumped up to 4.2.1, I got a new NoClassDefFound error. I tried all the versions from 4.2.1 to 4.7.1 and got different NoClassDefFound errors.
When I used v1.0.17, a warning about missing dependencies comes up. When I used v1.0.15, this missing dependencies warning disappears.
There looks to be bad references to a v2.0.59 of serenity-screenplay and serenity-screenplay-webdriver used by serenity-cucumber4 that do not exist in the maven repo.
This was another obstacle I ran into that was not discussed in the primary issue
All is working now
You can read more about how I approached solving the problem at: https://github.com/serenity-bdd/serenity-cucumber4/issues/9
You can also see the repo here: https://github.com/WB3Tech/Cucumber-Serenity-JUnit5
I upgrade to Java 12, and half-way implemented JUnit5. The TestRunner is not using the @ExtendWith() attribute that replaced @RunWith, it is still using the @RunWith() attribute from the jupiter-vintage package.
Upvotes: 1