Open subashniprasannasagecom opened 6 years ago
can you please provide a complete pom.xml ? It looks like you use the wrong dependencies. Thanks !
Even I had same error. Here is my POM file. Please excuse cluttering into the POM file. I just wanted to quickly reproduce my pom file which caused same error to occur a few days back.
I have observed that getTagFilters() method inside RuntimeOptions class is not present instead the method is getFilters() which is fulfilling the same purpose.
Here's my pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<groupId>desaru</groupId>
<artifactId>automation</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>automation</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<gherkin.version>2.12.2</gherkin.version>
<junit.version>4.12</junit.version>
<cucumber.junit.version>1.2.2</cucumber.junit.version>
<cucumber.jvm.version>1.2.2</cucumber.jvm.version>
<cucumber.java.version>1.2.2</cucumber.java.version>
<cucumber.core.version>1.2.2</cucumber.core.version>
<assertj.core.version>3.11.0</assertj.core.version>
<selenium.server.version>3.14.0</selenium.server.version>
<selenium.java.version>3.14.0</selenium.java.version>
<log4j.api.version>2.11.0</log4j.api.version>
<log4j.core.version>2.11.0</log4j.core.version>
<serenity.core.version>1.9.45</serenity.core.version>
<serenity.maven.version>1.1.21</serenity.maven.version>
<serenity.cucumber.version>1.9.14</serenity.cucumber.version>
<serenity.junit.version>1.0.23</serenity.junit.version>
<maven.surefire.plugin>2.20</maven.surefire.plugin>
<maven.failsafe.plugin>2.20</maven.failsafe.plugin>
<maven.compiler.plugin>3.7.0</maven.compiler.plugin>
<webdriver.driver>chrome</webdriver.driver>
<webdriver.base.url>http://scmedtest.desarucoast.com</webdriver.base.url>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/info.cukes/gherkin -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>gherkin</artifactId>
<version>${gherkin.version}</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-junit -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber.junit.version}</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-jvm -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<version>${cucumber.jvm.version}</version>
<type>pom</type>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-java -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>${cucumber.java.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-core -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-core</artifactId>
<version>${cucumber.core.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.assertj/assertj-core -->
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.core.version}</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-server -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>${selenium.server.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>${selenium.java.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.relevantcodes/extentreports -->
<dependency>
<groupId>com.relevantcodes</groupId>
<artifactId>extentreports</artifactId>
<version>2.41.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j.api.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j.core.version}</version>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-core</artifactId>
<version>${serenity.core.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-junit</artifactId>
<version>${serenity.junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-cucumber</artifactId>
<version>${serenity.cucumber.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.20</version>
<configuration>
<includes>
<include>**/*Test.java</include>
<include>**/Test*.java</include>
<include>**/*TestSuite.java</include>
<include>**/When*.java</include>
</includes>
<systemPropertyVariables>
<webdriver.base.url>${webdriver.base.url}</webdriver.base.url>
</systemPropertyVariables>
<parallel>classes</parallel>
<threadCount>1</threadCount>
<forkCount>1</forkCount>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>net.serenity-bdd.maven.plugins</groupId>
<artifactId>serenity-maven-plugin</artifactId>
<version>${serenity.maven.version}</version>
<configuration>
<tags>${tags}</tags>
</configuration>
<executions>
<execution>
<id>serenity-reports</id>
<phase>post-integration-test</phase>
<goals>
<goal>aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Here is my pom.xml: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>dm_final</artifactId>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<serenity.version>2.0.17</serenity.version>
<serenity.cucumber.version>1.9.20</serenity.cucumber.version>
<info.cukes.version>1.2.5</info.cukes.version>
<gherkin.version>2.12.2</gherkin.version>
<junit.version>4.12</junit.version>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/info.cukes/gherkin -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>gherkin</artifactId>
<version>${gherkin.version}</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-java -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>${info.cukes.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-core -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-core</artifactId>
<version>${info.cukes.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-junit -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${info.cukes.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-jvm-deps -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm-deps</artifactId>
<version>1.0.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-jvm -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<version>${info.cukes.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-core</artifactId>
<version>${serenity.version}</version>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-junit</artifactId>
<version>${serenity.version}</version>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-cucumber</artifactId>
<version>${serenity.cucumber.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.20</version>
<configuration>
<includes>
<include>**/*Test.java</include>
</includes>
<argLine>-Xmx512m</argLine>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>net.serenity-bdd.maven.plugins</groupId>
<artifactId>serenity-maven-plugin</artifactId>
<version>${serenity.version}</version>
<executions>
<execution>
<id>serenity-reports</id>
<phase>post-integration-test</phase>
<goals>
<goal>aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
I'm getting the same issue: java.lang.NoSuchMethodError: cucumber.runtime.RuntimeOptions.getTagFilters()Ljava/util/List;
at net.serenitybdd.cucumber.CucumberWithSerenity.createRuntime(CucumberWithSerenity.java:71)
at cucumber.api.junit.Cucumber.<init>(Cucumber.java:59)
at net.serenitybdd.cucumber.CucumberWithSerenity.<init>(CucumberWithSerenity.java:54)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:49)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:67)
Can someone advise me?
I think the problem is that you are still on cucumber 1.2.5 whereas the serenity version expects cucumber 2.x. Make sure the version of cucumber you are referencing matches exactly the Version used by your serenity release.
https://mvnrepository.com/artifact/info.cukes/cucumber-junit latest version of cucumber is 1.2.5
https://search.maven.org/search?q=g:io.cucumber%20AND%20a:cucumber-java&core=gav
Just let Serenity choose the version.
this is my build.gradle .. Same problem I am facing "java.lang.NoSuchMethodError: cucumber.runtime.RuntimeOptions.getFilters()Ljava/util/List".. Please help me
/*
plugins { // Apply the java-library plugin to add support for Java Library id 'java-library' }
repositories { // Use jcenter for resolving dependencies. // You can declare any Maven/Ivy/file repository here. //jcenter() mavenCentral() }
dependencies { compile group: 'commons-collections', name: 'commons-collections', version: '3.2' //testCompile group: 'junit', name: 'junit', version: '4.13' testCompile group: 'junit', name: 'junit', version: '4.+' compile ("net.serenity-bdd:serenity-core:1.9.19") compile ("net.serenity-bdd:serenity-screenplay:1.8.21") compile ("net.serenity-bdd:serenity-screenplay-webdriver:1.9.19") //compile "io.cucumber:cucumber-java:${cucumberJVMVersion}" //compile("io.cucumber:cucumber-junit:${cucumberJVMVersion}") { // exclude group: "junit" //} // compile("commons-logging:commons-logging:1.2.1.1") compile("org.apache.commons:commons-csv:1.6") // compile "junit:junit:${junitVersion}" compile "com.google.code.gson:gson:2.8.5"
// testCompile ("ch.qos.logback:logback-classic:${logbackVersion}") { // exclude module: "slf4j-api" // } testCompile "org.assertj:assertj-core:3.11.1" testCompile "org.codehaus.groovy:groovy-all:2.5.6" //testCompile "net.serenity-bdd:serenity-rest-assured:2.0.70" testCompile "net.serenity-bdd:serenity-rest-assured:2.0.70" testCompile "io.rest-assured:rest-assured:3.0.0" //testCompile 'net.serenity-bdd:serenity-cucumber:1.1.13' //testCompile 'net.serenity-bdd:serenity-cucumber:1.1.13' testCompile 'net.serenity-bdd:serenity-cucumber:1.1.12' compile group: 'com.googlecode.lambdaj', name: 'lambdaj', version: '2.3.3' //testCompile 'org.hamcrest:hamcrest-core:1.3' // testCompile("org.spockframework:spock-core:2.4") { // exclude group: "junit" // exclude module: "groovy-all" // } // testCompile("com.github.goldin:spock-extensions:${spockExtensionsVersion}") { // exclude module: "spock-core" // exclude module: "slf4j-api" // } }
You have a mixture of serenity versions, all quite old. Use the versions recommended on the link above.
Thanks @wakaleo problem got solved . Now I am not been able to execute API scenario. Error log
net.serenitybdd.core.exceptions.SerenityManagedException
at net.serenitybdd.rest.utils.RestDecorationHelper.decorate(RestDecorationHelper.java:20)
at net.serenitybdd.rest.SerenityRest.given(SerenityRest.java:216)
at test1.API_Testing.API_Demo(API_Testing.java:51)
at test1.API_Testing$ByteBuddy$Lkp8WDd9.API_Demo$accessor$jHAjAly0(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.thucydides.core.steps.BaseMethodRunner.invokeMethod(BaseMethodRunner.java:18)
at net.thucydides.core.steps.NormalMethodRunner.invokeMethodAndNotifyFailures(NormalMethodRunner.java:18)
at net.thucydides.core.steps.StepInterceptor.runNormalMethod(StepInterceptor.java:377)
at net.thucydides.core.steps.StepInterceptor.testStepResult(StepInterceptor.java:162)
at net.thucydides.core.steps.StepInterceptor.intercept(StepInterceptor.java:75)
at test1.API_Testing$ByteBuddy$Lkp8WDd9.API_Demo(Unknown Source)
at test1.Step_definition1.I_want_to_write_a_step_with_precondition_with(Step_definition1.java:28)
at ✽.I want to write a step with precondition with "posts"(src/test/java/feature/API_Test_Cucumber.feature:7)
Caused by: java.lang.IllegalArgumentException: Cannot resolve ambiguous delegation of public io.restassured.specification.ResponseSpecification io.restassured.specification.ResponseSpecification.root(java.lang.String) to net.bytebuddy.implementation.bind.MethodDelegationBinder$MethodBinding$Builder$Build@8605c725 or net.bytebuddy.implementation.bind.MethodDelegationBinder$MethodBinding$Builder$Build@73c9f1a5
at net.bytebuddy.implementation.bind.MethodDelegationBinder$BindingResolver$Default.doResolve(MethodDelegationBinder.java:636)
at net.bytebuddy.implementation.bind.MethodDelegationBinder$BindingResolver$Default.doResolve(MethodDelegationBinder.java:655)
at net.bytebuddy.implementation.bind.MethodDelegationBinder$BindingResolver$Default.doResolve(MethodDelegationBinder.java:650)
at net.bytebuddy.implementation.bind.MethodDelegationBinder$BindingResolver$Default.doResolve(MethodDelegationBinder.java:655)
at net.bytebuddy.implementation.bind.MethodDelegationBinder$BindingResolver$Default.doResolve(MethodDelegationBinder.java:655)
at net.bytebuddy.implementation.bind.MethodDelegationBinder$BindingResolver$Default.doResolve(MethodDelegationBinder.java:655)
at net.bytebuddy.implementation.bind.MethodDelegationBinder$BindingResolver$Default.doResolve(MethodDelegationBinder.java:650)
at net.bytebuddy.implementation.bind.MethodDelegationBinder$BindingResolver$Default.doResolve(MethodDelegationBinder.java:650)
at net.bytebuddy.implementation.bind.MethodDelegationBinder$BindingResolver$Default.doResolve(MethodDelegationBinder.java:647)
at net.bytebuddy.implementation.bind.MethodDelegationBinder$BindingResolver$Default.doResolve(MethodDelegationBinder.java:647)
at net.bytebuddy.implementation.bind.MethodDelegationBinder$BindingResolver$Default.doResolve(MethodDelegationBinder.java:647)
at net.bytebuddy.implementation.bind.MethodDelegationBinder$BindingResolver$Default.resolve(MethodDelegationBinder.java:611)
at net.bytebuddy.implementation.bind.MethodDelegationBinder$Processor.bind(MethodDelegationBinder.java:1098)
at net.bytebuddy.implementation.MethodDelegation$Appender.apply(MethodDelegation.java:1282)
at net.bytebuddy.dynamic.scaffold.TypeWriter$MethodPool$Record$ForDefinedMethod$WithBody.applyCode(TypeWriter.java:713)
at net.bytebuddy.dynamic.scaffold.TypeWriter$MethodPool$Record$ForDefinedMethod$WithBody.applyBody(TypeWriter.java:698)
at net.bytebuddy.dynamic.scaffold.TypeWriter$MethodPool$Record$ForDefinedMethod.apply(TypeWriter.java:605)
at net.bytebuddy.dynamic.scaffold.TypeWriter$Default$ForCreation.create(TypeWriter.java:5133)
at net.bytebuddy.dynamic.scaffold.TypeWriter$Default.make(TypeWriter.java:1933)
at net.bytebuddy.dynamic.scaffold.subclass.SubclassDynamicTypeBuilder.make(SubclassDynamicTypeBuilder.java:225)
at net.bytebuddy.dynamic.scaffold.subclass.SubclassDynamicTypeBuilder.make(SubclassDynamicTypeBuilder.java:198)
at net.bytebuddy.dynamic.DynamicType$Builder$AbstractBase.make(DynamicType.java:3404)
at net.bytebuddy.dynamic.DynamicType$Builder$AbstractBase$Delegator.make(DynamicType.java:3600)
at net.serenitybdd.rest.utils.RestSpecificationFactory.
unable to execute the line " given().headers(obj).when().get("http://jsonplaceholder.typicode.com/posts");"
When i try to run the cucumber test with @RunWith(CucumberWithSerenity.class) @CucumberOptions( plugin = {"pretty", "html:target/cucumber-html-report"}, features={"classpath:com/fs/AC8InheritingPattern.feature" // ,"classpath:com/fs/TearDown.feature" }) public class RunnerTest { }
i get the following exception
java.lang.NoSuchMethodError: cucumber.runtime.RuntimeOptions.getTagFilters()Ljava/util/List;
Process finished with exit code -1
i have the following maven dependency