I'm trying to run 2 Cucumber tests in parallel and sequential using TestNG and SpringBootTest but when my tests execute the following happens
mvn test
2 browsers open and both navigate to the Wikipedia homepage.
if you add 2 more scenarios it opens those many threads per scenario, I don't have any control over the number of threads to execute.
How to control the number of threads and dataprovider count, any help is appreciated.
Repo : https://github.com/cmccarthyIrl/spring-cucumber-testng-parallel-test-harness
The possible reason is, the runner you are using converts it into testng data driven test with single test with scenarios from each feature file supplied through data-provider. This is not a right approach. However, in testng there is separate property to set thread count for data driven test. You can set
data-provider-thread-countin xml configuration file at suite lever or can pass command-line argument-dataproviderthreadcountto specify number of threads.Better approach
You can look into another library qaf-cucumber with native testng implementation. It is considering each scenario as testng test method gives more control and utilization of each feature of testng. With this library, only scenario with examples are converted as testng data driven test.
You don't need to have additional class to run test. Just use factory available class to have different configuration combinations. Here is sample configuration file:
Note: As of today qaf-cucumber supports cucumber 5.x