As we all know executing our test case in parallel is
always an important and integral part of any testing framework. In this blog, we
are going to learn how we can execute parallel/Cross Browser Test in
Cucumber-Junit Testing Framework.
There are 2 different ways in which we can execute our Cucumber
test in parallel.
ร Maven
Surefire Plugin
ร Cucumber
JVM Parallel Plugin
In this blog, I am going to discuss the first approach since it’s pretty easy and straight forward without the need to add any additional plugin.
Please Note one important point that we need to have separate
Runner file for corresponding feature file to execute our test in parallel.
In this Blog for Demo Purpose, I have created two separate
feature files and their corresponding runner file. Below is how my project structure looks like
Now to execute these two feature file parallel we need
to do small modification in our Sure-fire Plugin. And need to add below 2
parameter under configuration in pom.xml
<forkCount>5</forkCount>
<reuseForks>true</reuseForks>
Here Forking is a special feature that
creates a separate JVM Processes. In this example, 5 JVM processes will get created. resuseForks
value can be true or false and will always be reused. and include tag will contain the path of our Runner File.
Here is my Sure-fire plugin Looks like:
Now if we execute our test with the help of pom.xml we can see that our test is getting executed in parallel
across 2 different browsers.
Please Allure/Extent report for the parallel execution
ReplyHello Ankur ,
ReplyGreat Article .
Can you please elaborate what would be structure runner files in above case as well ?
As mentioned in the blog you need to have 2 separate runner files for execution and it should be like your normal runner file which is usually used in cucumber
ReplyHi Ankur,
ReplyAs mentioned in the blog i have kept 2 runner files and executed POM file as JAVA application.What I see my both runner files are running serially and not in parallel
My pom file contains maven sure fire plugin as
org.apache.maven.plugins
maven-surefire-plugin
2.19.1
5
true
true
src/test/resources/Features
Please let me know if i missed something.