sebaslogen / CleanGUITestArchitecture

Sample project of Android GUI test automation using Espresso, Cucumber and the Page Object Pattern
MIT License
137 stars 31 forks source link

Trace -- java.lang.NoSuchMethodError: io.cucumber.tagexpressions.TagExpressionParser: method 'void <init>()' not found #30

Open shsharm opened 4 years ago

shsharm commented 4 years ago

Hi,

I am facing below error while running the test script from jmeter. Error -- runTest(org.apache.jmeter.protocol.java.sampler.JUnitSampler$AnnotatedTestCase): io.cucumber.tagexpressions.TagExpressionParser: method 'void ()' not found Trace -- java.lang.NoSuchMethodError: io.cucumber.tagexpressions.TagExpressionParser: method 'void ()' not found at io.cucumber.core.filter.TagPredicate.(TagPredicate.java:26) at io.cucumber.core.filter.Filters.(Filters.java:19) at io.cucumber.core.runtime.Runtime$Builder.build(Runtime.java:215) at io.cucumber.core.cli.Main.run(Main.java:73) at runner.TestRunner.runTest(TestRunner.java:31) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.apache.jmeter.protocol.java.sampler.JUnitSampler$AnnotatedTestCase.runTest(JUnitSampler.java:595) at junit.framework.TestResult.runProtected(TestResult.java:142) at org.apache.jmeter.protocol.java.sampler.JUnitSampler.sample(JUnitSampler.java:395) at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:630) at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:558) at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:489) at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256) at java.base/java.lang.Thread.run(Thread.java:834)

Having below snipets of code: package runner;

import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.junit.Test;

import io.cucumber.core.cli.Main;

public class TestRunner {

public ClassLoader load;

private static Logger Log = LogManager.getLogger(TestRunner.class);

protected TestRunner(String str) {
    // TODO Auto-generated constructor stub
    this();
}

public TestRunner() {
    // TODO Auto-generated constructor stub
}
// Test method is defined with Cucumber Main run method.
// "-g" signifies glue code (package where the code is), "-t" signifies the tag.
// The location of the feature file which defines the test scripts

@Test
public void runTest() throws Throwable {
    try {

        Main.run(new String[] { "-g", "step_definitions", "-t", "@upload",
                "src/test/resources/features/addcontent.feature" }, ClassLoader.getSystemClassLoader());
    Log.info("Print");

    } catch (Exception e) {
        e.printStackTrace();
    }
}
// Post Test what the JUNIT test needs to do

}

and added below dependencies in lib folder: cobertura-2.1.1.jar tag-expressions-3.0.0.jar gherkin-15.0.2 (1).jar cucumber-gherkin-6.5.1.jar cucumber-plugin-6.5.1.jar slf4j-api-1.7.9.jar joda-time-2.10.6.jar commons-lang3-3.10.jar commons-codec-1.14.jar mockito-core-3.5.5.jar gherkin-15.0.2.jar cucumber-jvm-deps-1.0.6.jar cucumber-junit-5.7.0.jar cucumber-java-5.7.0.jar cucumber-core-5.7.0.jar cobertura-1.8.jar

Please help me to solve this issue.