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

Karate UI - Running scenarios in parallel throws an error '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

抱歉,运行 浏览器 并行测试非常重要,这就是为什么我们有 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

编辑 - 也看到这个答案:

我建议像 Remote Browser Grid 这样使用 Zalenium 来实现并行性,并确保您的场景 self-contained 或至少保持功能独立。