Search code examples
seleniumcucumbercucumber-junit

Cucumber: Multiple Scenario Outlines are not getting executed in Cucumber 5.x.x: A possible bug?


In my feature file, I have two Scenario Outlines, with their own Examples section. I have tagged each of these Scenario Outlines differently(@test1, @test2). When I try to run both Scenario Outlines with Cucumber 5.6.0, I get the following error:-

0 Scenarios
0 Steps
0m0.001s

Only one Scenario Outline at a time is getting executed successfully with Cucumber 5.6.0. I get the same result with Cucumber 5.0.0

However, both scenario outlines are getting executed successfully when I downgrade to Cucumber 4.8.1. Scenario Outlines,however,do not work when I run them with Cucumber 4.8.1 and JUnit Test Runner v 4.13

Please take a look below at the Feature file and JUnit Test Runner class that I am using

Feature File under test:-

@GoogleMapPageObjectFactory
Feature: GoogleMapPageObjectFactory

 Background: setUpGoogleMapPageObjectFactoryTest
    Given ChromeDriver is available for GoogleMap Page
  And GoogleMap Page is opened
  And all GoogleMap page elements are initialised 

  @test1
  Scenario Outline: captureScreenShotatStartGoogleMap
    When I capture screenshot on GoogleMap page to be stored at "<screenshotFilePathStart>"
        Then an image should be stored in local drive path "<screenshotFilePathStart>"

    Examples:
    | screenshotFilePathStart |
    | F:\\Users\\User\\eclipse-workspace\\maven-demo\\screenshots\\GoogleMapPageObjectFactoryTest-start.jpg |

    @test2
    Scenario Outline: typeAndVerifyAddressGoogleMap
    When I type the "<searchAddress>" on GoogleMap Page
    Then I verify the section header contains "<searchAddress>" on GoogleMap Page

    Examples:
    | searchAddress |
    | Harvard Business School, Boston, MA 02163, United States |

  @test3
    Scenario: phnuminlinePopUpGoogleMap
    When I type the "+91 998877223" on GoogleMap Page
    Then I verify the inline popup window contains "+91 998877223" on GoogleMap Page    

JUnit Test Runner Class:-

package com.selenium.cucumber.junit.testrunner;

import org.junit.runner.RunWith;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;

@RunWith(Cucumber.class) 
@CucumberOptions(tags={"@test1","@test2"},
features= {"src/main/resources/com/selenium/cucumber/features/GoogleMapPageObjectFactory.feature"},
glue= {"com.selenium.cucumber.stepdef"}
) 
public class GoogleMapPageObjectFactoryTestRunner {

}

Solution

  • Sounds like a bug was introduced in v5.

    But try using a single tag expression instead. For example @test1 or @tes2.