Answers for "how to achieve parallel execution in cucumber"

0

how to achieve parallel execution in cucumber

To run parallel testing in Junit
We are using maven-surefire plugin
in pom.xml file.
We can specify how many threads we
want to run as at the same time.

We also have to make some changes 
in Driver class. We need to use 
"ThreadLocal<WebDriver> instead of
"WebDriver" Because "WebDriver" 
generates only a single WebDriver object, 
but "ThreadLocal<WebDriver>" generates
multiple browser to run parallel testing.


 <testFailureIgnore>TRUE</testFailureIgnore>
     <parallel>METHODS</parallel>
     <threadCount>40</threadCount> 
     <forkCount>2C</forkCount>
     <perCoreThreadCount>false</perCoreThreadCount>
     <include>**/*Runner*.java</include>

*Runner* - any test class Contains Runner
 Runner* - any test class starts with Runner
*Runner  - any test class ends with Runner 

PerCoreThreadCount: set false it will
try to match number of threads with number
of CPU cores. Regardsless on threadCount value.
Posted by: Guest on January-09-2021

Browse Popular Code Answers by Language