空手道网版本0.9.2
只要我的karate-config.js
评估失败,它就会打印:
16:49:28.753 [ForkJoinPool-1-worker-1] ERROR com.intuit.karate - evaluation of 'karate-config.js' failed: javascript function call failed: unexpected 'configure' key: 'followRedirectss'
16:49:28.761 [ForkJoinPool-1-worker-1] ERROR com.intuit.karate - javascript function call failed: unexpected 'configure' key: 'followRedirectss'
16:49:28.762 [ForkJoinPool-1-worker-1] ERROR com.intuit.karate - failed function body: function fn(){
<< MY SUPER AMAZING SCRIPT HERE >>
}
请注意,如果我故意因小错误而失败,只是为了引起它^
发生错误后,它将在我拥有的每个功能文件中为每个场景打印它,因此,如果有55个具有304个场景的功能文件和具有104行的karate-config.js,您可以想象这会很快变坏。
因此,空手道配置5行,有意失败+ 2种功能(单一情况)如下所示:
Generating a RSA private key
.+++++++++++++++++++++++++++
...+++++++++++++++++++++++++++
writing new private key to 'key.pem'
-----
17:06:36.217 [main] INFO com.intuit.karate.netty.Main - Karate version: 0.9.2
17:06:36.426 [main] INFO com.intuit.karate.Runner - Karate version: 0.9.2
17:06:37.434 [ForkJoinPool-1-worker-1] ERROR com.intuit.karate - javascript function call failed: unexpected 'configure' key: 'followRedirectss'
17:06:37.435 [ForkJoinPool-1-worker-1] ERROR com.intuit.karate - failed function body: function fn(){
karate.configure('followRedirectss', false);
// imagine having additional ~100 lines here
// and additional 54 features
}
17:06:37.436 [ForkJoinPool-1-worker-1] ERROR com.intuit.karate - evaluation of 'karate-config.js' failed: javascript function call failed: unexpected 'configure' key: 'followRedirectss'
17:06:37.554 [pool-1-thread-1] INFO com.intuit.karate.Runner - <<fail>> feature 1 of 2: src/features/null/null.feature
---------------------------------------------------------
feature: src/features/null/null.feature
report: target/src.features.null.null.json
scenarios: 1 | passed: 0 | failed: 1 | time: 0.0000
---------------------------------------------------------
17:06:37.584 [ForkJoinPool-1-worker-1] ERROR com.intuit.karate - javascript function call failed: unexpected 'configure' key: 'followRedirectss'
17:06:37.585 [ForkJoinPool-1-worker-1] ERROR com.intuit.karate - failed function body: function fn(){
karate.configure('followRedirectss', false);
// imagine having additional ~100 lines here
// and additional 54 features
}
17:06:37.586 [ForkJoinPool-1-worker-1] ERROR com.intuit.karate - evaluation of 'karate-config.js' failed: javascript function call failed: unexpected 'configure' key: 'followRedirectss'
17:06:37.589 [pool-1-thread-1] INFO com.intuit.karate.Runner - <<fail>> feature 2 of 2: src/features/null/null.1.feature
---------------------------------------------------------
feature: src/features/null/null.1.feature
report: target/src.features.null.null.1.json
scenarios: 1 | passed: 0 | failed: 1 | time: 0.0000
---------------------------------------------------------
Karate version: 0.9.2
======================================================
elapsed: 1.16 | threads: 1 | thread time: 0.00
features: 2 | ignored: 0 | efficiency: 0.00
scenarios: 2 | passed: 0 | failed: 2
======================================================
failed features:
src.features.null.null: null.feature:3 - evaluation of 'karate-config.js' failed: javascript function call failed: unexpected 'configure' key: 'followRedirectss'
src.features.null.null.1: null.1.feature:3 - evaluation of 'karate-config.js' failed: javascript function call failed: unexpected 'configure' key: 'followRedirectss'
Exception in thread "main" picocli.CommandLine$ExecutionException: there are test failures
at com.intuit.karate.netty.Main$1.handleExecutionException(Main.java:133)
at picocli.CommandLine.parseWithHandlers(CommandLine.java:1157)
at com.intuit.karate.netty.Main.main(Main.java:139)
有什么方法可以避免这种情况并且使karate-config.js失败,导致运行全部停止?
答案 0 :(得分:2)
您知道,karate-config.js
在每种情况之前都已执行。与此相关的问题被认为是“灾难性的”。空手道旨在尝试进入下一个场景。
可以随意打开功能请求,甚至可以提供修复程序-但我的猜测是由于callSingle()
的概念,很难采用适当的逻辑来完成您所请求的事情。>
我个人认为,如果karate-config.js
失败,此行为是可以接受的-您必须尽快修复它。您可以始终使用JUnit运行器或IDE集成来处理一项功能,并在继续使用整个套件之前解决此问题。