Reputation: 31
Good morning,
I just mounted the version of Karate and I have an unexpected behavior on the execution of tests in parallel.
I have a single feature file that I execute in parallel. In 10 simple API scenarios. If I add a sleep of 10 seconds in two scenarios then the execution will take 27 seconds. In 1.1.0 or 1.2.0 it takes 17 seconds. As if the parallelization had no place.
I use the sleep method proposed on the documentation. My sleep method is called in CallSingle in my background file ( like in the Example below )
Result :
Karate version: 1.1.0
======================================================
elapsed: 16,70 | threads: 25 | thread time: 87,05
features: 1 | skipped: 0 | efficiency: 0,21
scenarios: 34 | passed: 34 | failed: 0
======================================================
Karate version: 1.3.0
======================================================
elapsed: 25,51 | threads: 25 | thread time: 126,30
features: 1 | skipped: 0 | efficiency: 0,20
scenarios: 34 | passed: 34 | failed: 0
======================================================
My runner :
Results results = Runner.path(
"classpath:Tenant/TenantAPI/gestionTenantAPI.feature"
).tags("\~@ignore").reportDir("target/surefire-reports-myrunner).outputCucumberJson(true).outputJunitXml(true)
.parallel(25);
karateReportCucumber.generateReport(results.getReportDir(), runner);
assertEquals(0, results.getFailCount(), results.getErrorMessages());
Exemple of Feature :
Feature : Test Sleep
Background:
* def SleepGenerator = karate.call('classpath:Common/Utils/generators.feature@sleepGenerator').SleepGenerator
Scenario: Number 01
* def pause = SleepGenerator(10000)
Given url url_api + '/v1/myapp/code/karate'
And header Content-Type = 'application/json'
And header Authorization = "Bearer " + token_bearer
When method GET
Then status 200
Scenario:Number 01
* def pause = SleepGenerator(10000)
Given url url_api + '/v1/myapp/code/MAGICSTRING'
And header Content-Type = 'application/json'
And header Authorization = "Bearer " + token_bearer
When method GET
Then status 200
Upvotes: 1
Views: 415
Reputation: 31
Thanks for the quick response. I just got the Karate sources, I built a 1.4.0-Snapshot from the development branch and I have exactly the same result.
Karate version: 1.4.0-SNAPSHOT
======================================================
elapsed: 24,24 | threads: 25 | thread time: 165,23
features: 1 | skipped: 0 | efficiency: 0,27
scenarios: 34 | passed: 34 | failed: 0
======================================================
You can contact me later on my Stack account if you want a beta tester. Am using karate since 4 Year.
Upvotes: 1
Reputation: 58058
Can you please read this thread: https://github.com/karatelabs/karate/issues/2222#issuecomment-1420534265
In the meantime, if you can try build locally that will greatly help.
Upvotes: 1