Book Image

Cucumber Cookbook

By : Shankar Garg
Book Image

Cucumber Cookbook

By: Shankar Garg

Overview of this book

Table of Contents (13 chapters)
Cucumber Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Running Cucumber test cases in parallel


Running test cases in parallel is a very common and required practice for a good automation framework. Cucumber, by default, does not have any such option or setting. However, since Cucumber can be integrated with Maven and JUnit, using these two tools, we can run Cucumber Scenarios in parallel.

In this recipe, we will run two Scenarios in parallel and, for web automation that will mean opening two browsers at the same time. So how do we make this possible? Let's understand in the next section.

How to do it…

  1. We create a Feature file that has two Scenarios. We will aim to run these two Scenarios in parallel. This is just for the purpose of a demo, you can implement the same approach for n number of Scenarios.

    Both the Scenarios will be associated with two different Tags so that they can be run using these tags. Focus on the highlighted tags in the following code; our Feature file should look something like this:

    Feature: sample
    
      @sanity
      Scenario: Home...