Karate UI - Running scenarios in parallel throws an error 'HttpHostConnectException: connect to localhost:9222'

I am trying to execute a feature with 3 scenarios in it using:

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

With @parallel=false works fine however when I removed, it fails with the following error:

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}

This occurs at the * driver <url> phase. This is an intermittent failure which most of the time 2/3 scenarios pass and one fails with this error.

Version: 0.9.6.RC3


Sorry, running browser tests in parallel is non-trivial which is why we have the Docker option.

EDIT: and in case you landed here because you wanted karate.callSingle() to work for UI tests, sorry that is not possible as well. But you are encouraged to perform an API sign-in via karate.callSingle() and then speed up your UI tests: https://github.com/intuit/karate/tree/develop/karate-core#hybrid-tests

Consider that this is not supported on a single node. It can be made to work if you know what you are doing, but you need to figure this out depending on whether you are using Chrome or WebDriver.

Please refer the docs: https://twitter.com/ptrthomas/status/1159295560794308609 | https://github.com/intuit/karate/tree/master/karate-core#configure-drivertarget

EDIT - also see this answer: https://stackoverflow.com/a/60387907/143475


I recommend using Zalenium like Remote Browser Grid to achieve parallelism and make sure that your scenario are self-contained or atleast keep feature independent.