mercredi 31 janvier 2018

Karate @RunWith(Karate.class) throwing Error

I am seeing below error when i am running my features with @RunWith(Karate.class)

I have found an an option to run with Junit which works fine however does not generate the karate reports. All my test cases are passing without any issues however i would like to run with Karate so that i get the nice report.

@RunWith(SpringRunner.class)
@CucumberOptions(tags = "~@ignore")
public class RestServicesDmaTestApplicationTests {

    @Test
    public void testABC(){
        CucumberRunner.runFeature(getClass(), "/features/ABC.feature",new HashedMap(),true);
    }
}

I am getting below error when i am running with Karate.

@RunWith(Karate.class)
@CucumberOptions(tags = "~@ignore",features = {"classpath:com/mastercard/send/features/ABC.feature})
public class KarateJunitTest {

    @BeforeClass
    public static void before() {
        System.setProperty("karate.env", "stage");
    }    
}



java.lang.NoSuchMethodError: ch.qos.logback.classic.encoder.PatternLayoutEncoder.encode(Ljava/lang/Object;)[B

            at com.intuit.karate.cucumber.ReporterLogAppender.append(ReporterLogAppender.java:72)
            at com.intuit.karate.cucumber.ReporterLogAppender.append(ReporterLogAppender.java:38)
            at ch.qos.logback.core.AppenderBase.doAppend(AppenderBase.java:82)
            at ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:51)
            at ch.qos.logback.classic.Logger.appendLoopOnAppenders(Logger.java:270)
            at ch.qos.logback.classic.Logger.callAppenders(Logger.java:257)
            at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:421)
            at ch.qos.logback.classic.Logger.filterAndLog_1(Logger.java:398)
            at ch.qos.logback.classic.Logger.info(Logger.java:583)
            at com.intuit.karate.ScriptBridge.log(ScriptBridge.java:164)
            at jdk.nashorn.internal.scripts.Script$Recompilation$5$18$\^eval\_.config(<eval>:7)
            at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:636)
            at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:229)
            at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:387)
            at jdk.nashorn.api.scripting.ScriptObjectMirror.call(ScriptObjectMirror.java:110)
            at com.intuit.karate.Script.evalFunctionCall(Script.java:1532)
            at com.intuit.karate.Script.call(Script.java:1489)
            at com.intuit.karate.Script.callAndUpdateConfigAndAlsoVarsIfMapReturned(Script.java:1606)
            at com.intuit.karate.ScriptContext.<init>(ScriptContext.java:131)
            at com.intuit.karate.StepDefs.<init>(StepDefs.java:81)
            at com.intuit.karate.cucumber.KarateObjectFactory.getInstance(KarateObjectFactory.java:80)
            at cucumber.runtime.java.JavaStepDefinition.execute(JavaStepDefinition.java:38)
            at cucumber.runtime.StepDefinitionMatch.runStep(StepDefinitionMatch.java:37)
            at com.intuit.karate.cucumber.CucumberUtils.runStep(CucumberUtils.java:139)
            at com.intuit.karate.cucumber.KarateRuntime.runStep(KarateRuntime.java:80)
            at cucumber.runtime.model.StepContainer.runStep(StepContainer.java:44)
            at cucumber.runtime.model.StepContainer.runSteps(StepContainer.java:39)
            at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:44)
            at cucumber.runtime.junit.ExecutionUnitRunner.run(ExecutionUnitRunner.java:102)
            at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:63)
            at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:18)
            at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
            at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
            at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
            at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
            at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
            at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
            at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:70)
            at com.intuit.karate.junit4.Karate.runChild(Karate.java:118)
            at com.intuit.karate.junit4.Karate.runChild(Karate.java:33)
            at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
            at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
            at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
            at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
            at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
            at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
            at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
            at com.intuit.karate.junit4.Karate.run(Karate.java:127)
            at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
            at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
            at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
            at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:237)
            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:497)
            at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)

Aucun commentaire:

Enregistrer un commentaire