Closed WB3Tech closed 5 years ago
NoClassDefFound is a version conflict. Try doing a Maven dependency analysis to see what the conflict is. Serenity does not support JUnit 5 yet, so mileages may vary with JUnit 5
@wakaleo I ran mvn dependency:tree
and checked it out. Below are the results. If I'm reading this correctly, I don't see any cucumber or Junit conflicts. I don't see any cucumber or serenity conflicts.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building modular-java 1.0.0
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for net.serenity-bdd:serenity-core:jar:2.0.59 is missing, no dependency information available
[WARNING] The POM for net.serenity-bdd:serenity-screenplay:jar:2.0.59 is missing, no dependency information available
[WARNING] The POM for net.serenity-bdd:serenity-screenplay-webdriver:jar:2.0.59 is missing, no dependency information available
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ modular-java ---
[INFO] wb3:modular-java:jar:1.0.0
[INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.5.1:test
[INFO] | +- org.apiguardian:apiguardian-api:jar:1.1.0:test
[INFO] | +- org.junit.platform:junit-platform-engine:jar:1.5.1:test
[INFO] | | +- org.opentest4j:opentest4j:jar:1.2.0:test
[INFO] | | \- org.junit.platform:junit-platform-commons:jar:1.5.1:test
[INFO] | \- org.junit.jupiter:junit-jupiter-api:jar:5.5.1:test
[INFO] +- org.junit.vintage:junit-vintage-engine:jar:5.5.1:test
[INFO] | \- junit:junit:jar:4.12:test
[INFO] +- io.cucumber:cucumber-java:jar:4.7.1:test
[INFO] | \- io.cucumber:cucumber-core:jar:4.7.1:test
[INFO] | +- io.cucumber:gherkin:jar:5.1.0:test
[INFO] | +- io.cucumber:tag-expressions:jar:1.1.1:test
[INFO] | +- io.cucumber:cucumber-expressions:jar:7.0.2:test
[INFO] | \- io.cucumber:datatable:jar:1.1.14:test
[INFO] | \- io.cucumber:datatable-dependencies:jar:1.1.14:test
[INFO] +- io.cucumber:cucumber-junit:jar:4.7.1:test
[INFO] +- net.serenity-bdd:serenity-cucumber4:jar:1.0.17:test
[INFO] | +- io.cucumber:datatable-matchers:jar:1.1.7:test
[INFO] | +- commons-logging:commons-logging:jar:1.2:test
[INFO] | +- org.apache.commons:commons-csv:jar:1.5:test
[INFO] | \- com.google.code.gson:gson:jar:2.8.4:test
[INFO] +- net.serenity-bdd:serenity-core:jar:2.0.63:test
[INFO] | +- net.bytebuddy:byte-buddy:jar:1.9.12:test
[INFO] | +- net.bytebuddy:byte-buddy-agent:jar:1.9.12:test
[INFO] | +- com.google.guava:guava:jar:25.0-jre:test
[INFO] | | +- com.google.code.findbugs:jsr305:jar:1.3.9:test
[INFO] | | +- org.checkerframework:checker-compat-qual:jar:2.0.0:test
[INFO] | | +- com.google.errorprone:error_prone_annotations:jar:2.1.3:test
[INFO] | | +- com.google.j2objc:j2objc-annotations:jar:1.1:test
[INFO] | | \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.14:test
[INFO] | +- com.google.inject:guice:jar:4.2.2:test
[INFO] | | +- javax.inject:javax.inject:jar:1:test
[INFO] | | \- aopalliance:aopalliance:jar:1.0:test
[INFO] | +- cglib:cglib:jar:3.2.5:test
[INFO] | +- org.ow2.asm:asm:jar:5.0.3:test
[INFO] | +- commons-codec:commons-codec:jar:1.10:test
[INFO] | +- org.objenesis:objenesis:jar:2.6:test
[INFO] | +- org.slf4j:slf4j-api:jar:1.7.25:test
[INFO] | +- xml-apis:xml-apis:jar:1.4.01:test
[INFO] | +- io.vavr:vavr:jar:0.9.0:test
[INFO] | | \- io.vavr:vavr-match:jar:0.9.0:test
[INFO] | +- javax.xml.bind:jaxb-api:jar:2.2.12:test
[INFO] | +- com.sun.xml.bind:jaxb-core:jar:2.3.0.1:test
[INFO] | +- com.sun.xml.bind:jaxb-impl:jar:2.3.0.1:test
[INFO] | +- javax.activation:activation:jar:1.1.1:test
[INFO] | +- org.mockito:mockito-core:jar:2.25.0:test
[INFO] | +- net.serenity-bdd:serenity-report-resources:jar:2.0.63:test
[INFO] | +- net.serenity-bdd:serenity-model:jar:2.0.63:test
[INFO] | | +- commons-net:commons-net:jar:3.6:test
[INFO] | | \- org.apache.commons:commons-text:jar:1.6:test
[INFO] | +- net.serenity-bdd:serenity-reports:jar:2.0.63:test
[INFO] | | \- net.serenity-bdd:serenity-stats:jar:2.0.63:test
[INFO] | | \- org.jetbrains.kotlin:kotlin-stdlib:jar:1.3.31:test
[INFO] | | +- org.jetbrains.kotlin:kotlin-stdlib-common:jar:1.3.31:test
[INFO] | | \- org.jetbrains:annotations:jar:13.0:test
[INFO] | +- commons-io:commons-io:jar:2.6:test
[INFO] | +- org.seleniumhq.selenium:selenium-server:jar:3.141.59:test
[INFO] | | +- org.seleniumhq.selenium:selenium-firefox-driver:jar:3.141.59:test
[INFO] | | +- org.seleniumhq.selenium:selenium-ie-driver:jar:3.141.59:test
[INFO] | | +- com.beust:jcommander:jar:1.72:test
[INFO] | | +- org.apache.commons:commons-exec:jar:1.3:test
[INFO] | | +- net.jcip:jcip-annotations:jar:1.0:test
[INFO] | | +- org.seleniumhq.selenium:jetty-repacked:jar:9.4.12.v20180830:test
[INFO] | | +- com.squareup.okhttp3:okhttp:jar:3.11.0:test
[INFO] | | +- com.squareup.okio:okio:jar:1.14.0:test
[INFO] | | +- javax.servlet:javax.servlet-api:jar:3.1.0:test
[INFO] | | \- org.yaml:snakeyaml:jar:1.19:test
[INFO] | +- org.seleniumhq.selenium:selenium-java:jar:3.141.59:test
[INFO] | +- org.seleniumhq.selenium:selenium-api:jar:3.141.59:test
[INFO] | +- org.seleniumhq.selenium:selenium-chrome-driver:jar:3.141.59:test
[INFO] | +- org.seleniumhq.selenium:selenium-edge-driver:jar:3.141.59:test
[INFO] | +- org.seleniumhq.selenium:selenium-remote-driver:jar:3.141.59:test
[INFO] | +- org.seleniumhq.selenium:selenium-safari-driver:jar:3.141.59:test
[INFO] | +- org.seleniumhq.selenium:selenium-opera-driver:jar:3.141.59:test
[INFO] | +- org.seleniumhq.selenium:selenium-support:jar:3.141.59:test
[INFO] | +- com.paulhammant:ngwebdriver:jar:1.1.4:test
[INFO] | +- com.codeborne:phantomjsdriver:jar:1.4.4:test
[INFO] | +- org.eclipse.jetty:jetty-util:jar:9.4.8.v20171121:test
[INFO] | +- org.eclipse.jetty:jetty-io:jar:9.4.8.v20171121:test
[INFO] | +- org.seleniumhq.selenium:htmlunit-driver:jar:2.33.1:test
[INFO] | +- io.appium:java-client:jar:7.0.0:test
[INFO] | | +- commons-validator:commons-validator:jar:1.6:test
[INFO] | | | +- commons-beanutils:commons-beanutils:jar:1.9.2:test
[INFO] | | | \- commons-digester:commons-digester:jar:1.8.1:test
[INFO] | | \- org.aspectj:aspectjweaver:jar:1.9.1:test
[INFO] | +- org.springframework:spring-context-support:jar:5.1.2.RELEASE:test
[INFO] | | +- org.springframework:spring-beans:jar:5.1.2.RELEASE:test
[INFO] | | +- org.springframework:spring-context:jar:5.1.2.RELEASE:test
[INFO] | | | +- org.springframework:spring-aop:jar:5.1.2.RELEASE:test
[INFO] | | | \- org.springframework:spring-expression:jar:5.1.2.RELEASE:test
[INFO] | | \- org.springframework:spring-core:jar:5.1.2.RELEASE:test
[INFO] | | \- org.springframework:spring-jcl:jar:5.1.2.RELEASE:test
[INFO] | +- org.glassfish.tyrus:tyrus-core:jar:1.13.1:test
[INFO] | | \- org.glassfish.tyrus:tyrus-spi:jar:1.13.1:test
[INFO] | | \- javax.websocket:javax.websocket-api:jar:1.1:test
[INFO] | +- org.codehaus.groovy:groovy:jar:2.5.5:test
[INFO] | +- net.sf.opencsv:opencsv:jar:2.0:test
[INFO] | +- commons-beanutils:commons-beanutils-core:jar:1.8.3:test
[INFO] | +- joda-time:joda-time:jar:2.7:test
[INFO] | +- com.thoughtworks.xstream:xstream:jar:1.4.9:test
[INFO] | | +- xmlpull:xmlpull:jar:1.1.3.1:test
[INFO] | | \- xpp3:xpp3_min:jar:1.1.4c:test
[INFO] | +- org.apache.commons:commons-lang3:jar:3.8.1:test
[INFO] | +- commons-collections:commons-collections:jar:3.2.2:test
[INFO] | +- org.freemarker:freemarker:jar:2.3.28:test
[INFO] | +- net.sourceforge.jexcelapi:jxl:jar:2.6.12:test
[INFO] | +- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] | +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] | +- net.sourceforge.htmlunit:htmlunit:jar:2.33:test
[INFO] | | +- net.sourceforge.htmlunit:htmlunit-core-js:jar:2.33:test
[INFO] | | +- net.sourceforge.htmlunit:neko-htmlunit:jar:2.33:test
[INFO] | | | \- xerces:xercesImpl:jar:2.12.0:test
[INFO] | | +- net.sourceforge.htmlunit:htmlunit-cssparser:jar:1.2.0:test
[INFO] | | \- org.eclipse.jetty.websocket:websocket-client:jar:9.4.12.v20180830:test
[INFO] | | +- org.eclipse.jetty:jetty-client:jar:9.4.12.v20180830:test
[INFO] | | | \- org.eclipse.jetty:jetty-http:jar:9.4.12.v20180830:test
[INFO] | | +- org.eclipse.jetty:jetty-xml:jar:9.4.12.v20180830:test
[INFO] | | \- org.eclipse.jetty.websocket:websocket-common:jar:9.4.12.v20180830:test
[INFO] | | \- org.eclipse.jetty.websocket:websocket-api:jar:9.4.12.v20180830:test
[INFO] | +- org.apache.httpcomponents:httpclient:jar:4.5.5:test
[INFO] | | \- org.apache.httpcomponents:httpcore:jar:4.4.9:test
[INFO] | +- org.apache.httpcomponents:httpmime:jar:4.5.5:test
[INFO] | +- org.fluentlenium:fluentlenium-core:jar:0.10.2:test
[INFO] | +- com.jhlabs:filters:jar:2.0.235:test
[INFO] | +- org.asciidoctor:asciidoctorj:jar:1.5.6:test
[INFO] | | \- org.jruby:jruby-complete:jar:1.7.26:test
[INFO] | +- org.imgscalr:imgscalr-lib:jar:4.2:test
[INFO] | +- javax.el:javax.el-api:jar:2.2.4:test
[INFO] | +- org.glassfish.web:javax.el:jar:2.2.4:test
[INFO] | +- xalan:xalan:jar:2.7.2:test
[INFO] | +- xalan:serializer:jar:2.7.2:test
[INFO] | +- org.awaitility:awaitility:jar:3.1.0:test
[INFO] | +- com.typesafe:config:jar:1.3.1:test
[INFO] | +- org.jsoup:jsoup:jar:1.10.3:test
[INFO] | +- com.google.jimfs:jimfs:jar:1.1:test
[INFO] | +- es.nitaur.markdown:txtmark:jar:0.16:test
[INFO] | \- com.vladsch.flexmark:flexmark-all:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark-ext-abbreviation:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark-ext-admonition:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark-ext-anchorlink:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark-ext-aside:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark-ext-attributes:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark-ext-autolink:jar:0.34.30:test
[INFO] | | \- org.nibor.autolink:autolink:jar:0.6.0:test
[INFO] | +- com.vladsch.flexmark:flexmark-ext-definition:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark-ext-emoji:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark-ext-enumerated-reference:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark-ext-escaped-character:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark-ext-footnotes:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark-ext-gfm-issues:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark-ext-gfm-strikethrough:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark-ext-gfm-tables:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark-ext-gfm-tasklist:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark-ext-gfm-users:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark-ext-gitlab:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark-ext-jekyll-front-matter:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark-ext-jekyll-tag:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark-ext-media-tags:jar:0.34.30:test
[INFO] | | \- com.vladsch.flexmark:flexmark-test-util:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark-ext-ins:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark-ext-xwiki-macros:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark-ext-superscript:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark-ext-tables:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark-ext-toc:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark-ext-typographic:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark-ext-wikilink:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark-ext-yaml-front-matter:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark-ext-youtube-embedded:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark-formatter:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark-html-parser:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark-jira-converter:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark-pdf-converter:jar:0.34.30:test
[INFO] | | +- com.openhtmltopdf:openhtmltopdf-core:jar:0.0.1-RC13:test
[INFO] | | +- com.openhtmltopdf:openhtmltopdf-pdfbox:jar:0.0.1-RC13:test
[INFO] | | | +- org.apache.pdfbox:pdfbox:jar:2.0.8:test
[INFO] | | | | \- org.apache.pdfbox:fontbox:jar:2.0.8:test
[INFO] | | | +- org.apache.pdfbox:xmpbox:jar:2.0.8:test
[INFO] | | | \- de.rototor.pdfbox:graphics2d:jar:0.12:test
[INFO] | | +- com.openhtmltopdf:openhtmltopdf-rtl-support:jar:0.0.1-RC13:test
[INFO] | | | \- com.ibm.icu:icu4j:jar:59.1:test
[INFO] | | \- com.openhtmltopdf:openhtmltopdf-jsoup-dom-converter:jar:0.0.1-RC13:test
[INFO] | +- com.vladsch.flexmark:flexmark-profile-pegdown:jar:0.34.30:test
[INFO] | +- com.vladsch.flexmark:flexmark-util:jar:0.34.30:test
[INFO] | \- com.vladsch.flexmark:flexmark-youtrack-converter:jar:0.34.30:test
[INFO] +- net.serenity-bdd:serenity-junit:jar:2.0.63:test
[INFO] +- net.serenity-bdd:serenity-screenplay:jar:2.0.61:test
[INFO] | \- uk.com.robust-it:cloning:jar:1.9.10:test
[INFO] \- net.serenity-bdd:serenity-screenplay-webdriver:jar:2.0.61:test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.852 s
[INFO] Finished at: 2019-07-30T16:16:27-04:00
[INFO] Final Memory: 15M/67M
[INFO] ------------------------------------------------------------------------
@wakaleo , I also noticed that I cannot mvn verify
without added net.serenity-bdd:serenity-screenplay & net.serenity-bdd:serenity-screenplay-wedriver to my POM, even though I'm not using them.
Based on all the documentation I have seen these are not required. Also, it seems that each of these are a transitive dependency and are looking for a version (2.0.59) that does not exist in the maven repositories.
...Edit...
After checking on my assumption from above, you'll notice the 1.0.17 version of serenity-cucumber4 (the one i'm using) has a dependency on the versions stated . (https://mvnrepository.com/artifact/net.serenity-bdd/serenity-cucumber4/1.0.17), but when you go to those repositories, a version for those do not exist.
screenplay: https://mvnrepository.com/artifact/net.serenity-bdd/serenity-screenplay screenplay-webdriver: https://mvnrepository.com/artifact/net.serenity-bdd/serenity-screenplay-webdriver
[WARNING] The POM for net.serenity-bdd:serenity-core:jar:2.0.59 is missing, no dependency information available
[WARNING] The POM for net.serenity-bdd:serenity-screenplay:jar:2.0.59 is missing, no dependency information available
[WARNING] The POM for net.serenity-bdd:serenity-screenplay-webdriver:jar:2.0.59 is missing, no dependency information available
Could not resolve dependencies for project wb3:modular-java:jar:1.0.0: The following artifacts could not be resolved: net.serenity-bdd:serenity-screenplay:jar:2.0.59, net.serenity-bdd:serenity-screenplay-webdriver:jar:2.0.59: Failure to find net.serenity-bdd:serenity-screenplay:jar:2.0.59 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
@wakaleo , I believe I got to root cause. I see possibly two issues here, only one is related to serenity
1) serenity-cucumber4 | v1.0.17
2) cucumber-java
Hopefully this helps out, if this is an actual issue for more than just me!
You can see the final demo at: https://github.com/WB3Tech/Cucumber-Serenity-JUnit5
While I have JUnit 5 in the project, the TestRunner is not using the @ExtendWith attribute, it's using the @RunWith attribute from JUnit 4 (jupiter-vintage). I have upgraded to Java 12 and that works as well.
It seems the Assertions Class has moved: io.cucumber.junit.Assertions in io.cucumber:cucumber-junit:4.7.2 (referenced from net.serenitybdd.cucumber.CucumberWithSerenity)
serenity-cucumber4 only supports cucumber version 4.2.0. Don't override the version of cucumber - the APIs change and transitive dependencies are there for a reason.
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. I also reviewed the recommendations at this closed issue and followed them: https://github.com/serenity-bdd/serenity-cucumber4/issues/8
Here is the stack trace. I was able to get this when I tried running the tests with IntelliJ.