Parallel/Cross Browser Testing in Cucumber-Junit


Parallel/Cross Browser Testing in Cucumber-Junit

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.






SHARE THIS

Author:

My Name is Ankur Jain and I am currently working as Automation Test Architect.I am ISTQB Certified Test Manager,Certified UI Path RPA Developer as well as Certified Scrum Master with total 12 years of working experience with lot of big banking clients around the globe.I love to Design Automation Testing Frameworks with Selenium,Appium,Protractor,Cucumber,Rest-Assured, Katalon Studio and currently exploring lot in Dev-OPS as well. I am currently staying in Mumbai, Maharashtra. Please Connect with me through Contact Us page of this website.

Previous Post
Next Post
January 31, 2019 at 12:48 PM

Please Allure/Extent report for the parallel execution

Reply
avatar
Anonymous
May 20, 2019 at 5:41 PM

Hello Ankur ,
Great Article .
Can you please elaborate what would be structure runner files in above case as well ?

Reply
avatar
May 20, 2019 at 10:29 PM

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

Reply
avatar
July 9, 2019 at 10:30 PM

Hi Ankur,

As 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.

Reply
avatar