在karate-config.js中配置重试

时间:2019-06-06 14:44:57

标签: karate

我正在使用以下语句在karate-config.js中配置重试:
karate.configure('retry',{ count: 10, interval: 5000 }); 运行测试时,我在控制台中收到以下错误:

  

[main] com.intuit.karate错误-javascript函数调用失败:   意外的“配置”键:“重试”。

有人可以建议解决此问题的方法吗?

karate.configure('retry',{ count: 10, interval: 5000 });

java.lang.RuntimeException: evaluation of karate-config.js failed:

    at com.intuit.karate.ScriptContext.<init>(ScriptContext.java:154)
    at com.intuit.karate.StepDefs.<init>(StepDefs.java:78)
    at com.intuit.karate.cucumber.KarateObjectFactory.getInstance(KarateObjectFactory.java:80)
    at com.intuit.karate.cucumber.KarateObjectFactory.getStepDefs(KarateObjectFactory.java:87)
    at com.intuit.karate.cucumber.KarateBackend.getStepDefs(KarateBackend.java:124)
    at com.intuit.karate.cucumber.KarateBackend.afterStep(KarateBackend.java:98)
    at com.intuit.karate.cucumber.CucumberUtils.afterStep(CucumberUtils.java:285)
    at com.intuit.karate.cucumber.CucumberUtils.runStep(CucumberUtils.java:239)
    at com.intuit.karate.cucumber.KarateRuntime.runStep(KarateRuntime.java:81)
    at cucumber.runtime.model.StepContainer.runStep(StepContainer.java:44)
    at cucumber.runtime.model.StepContainer.runSteps(StepContainer.java:39)
    at cucumber.runtime.model.CucumberScenario.runBackground(CucumberScenario.java:59)
    at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:42)
    at cucumber.runtime.model.CucumberScenarioOutline.run(CucumberScenarioOutline.java:46)
    at cucumber.runtime.model.CucumberFeature.run(CucumberFeature.java:165)
    at runnerClasses.TestReportRunner.feature(TestReportRunner.java:174)
    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 org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:643)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
    at org.testng.TestRunner.privateRun(TestRunner.java:782)
    at org.testng.TestRunner.run(TestRunner.java:632)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
    at org.testng.SuiteRunner.run(SuiteRunner.java:268)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
    at org.testng.TestNG.run(TestNG.java:1064)
    at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:72)
    at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:123)
Caused by: com.intuit.karate.exception.KarateException: javascript function call failed: unexpected 'configure' key: 'retry'
    at com.intuit.karate.Script.evalFunctionCall(Script.java:1601)
    at com.intuit.karate.Script.call(Script.java:1552)
    at com.intuit.karate.Script.callAndUpdateConfigAndAlsoVarsIfMapReturned(Script.java:1669)
    at com.intuit.karate.ScriptContext.<init>(ScriptContext.java:149)
    ... 38 more

1 个答案:

答案 0 :(得分:0)

肯定可以肯定,您使用的是空手道的旧版本。升级。阅读发行说明(0.9.0):https://github.com/intuit/karate/releases