空手道 UI - 并行运行方案引发错误'HttpHostConnectException: connect to localhost:9222'



我正在尝试使用以下方法执行具有 3 种场景的功能:

Results results = Runner.parallel(tagQuery, featurePaths, null, new ArrayList<>(), 3, karateOutputPath);

使用 @parallel=false 工作正常,但是当我删除时,它失败并出现以下错误:

com.intuit.karate.exception.KarateException: test_input.feature:50 - driver config / start failed: 
org.apache.http.conn.HttpHostConnectException: Connect to localhost:9222 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect, options: {type=chrome, target=null}

这发生在* driver <url> phase.这是一个间歇性故障,大多数情况下 2/3 个场景都会通过,其中一个场景会因此错误而失败。

版本: 0.9.6.RC3

我建议使用像远程浏览器网格这样的Zalenium来实现并行性,并确保您的方案是独立的,或者至少保持功能独立。

抱歉,并行运行浏览器测试并非易事,这就是我们有 Docker 选项的原因。

编辑:如果你登陆这里是因为你想karate.callSingle()为UI测试工作,对不起,这也是不可能的。但建议您通过karate.callSingle()执行 API 登录,然后加快 UI 测试速度:https://github.com/intuit/karate/tree/develop/karate-core#hybrid-tests

请注意,单个节点不支持此功能。如果您知道自己在做什么,则可以使其工作,但是您需要根据使用的是Chrome还是WebDriver来弄清楚这一点。

请参考文档:https://twitter.com/ptrthomas/status/1159295560794308609 | https://github.com/intuit/karate/tree/master/karate-core#configure-drivertarget

编辑 - 另请参阅此答案:https://stackoverflow.com/a/60387907/143475

最新更新