execute multiple cucumber feature files

20,671

Solution 1

This is for Java-Cucumber users :: Multiple Features are 1.Smoketest 2. Logintest Then your Junit runner java file should look like

@RunWith(Cucumber.class)    
    @CucumberOptions 
    (features = "src/test/java/testStep/",#Path for the Feature files Folder.Given you have smoke.feature and login.feature files present in the Path#
    plugin ={"pretty","html:reports/test-report"},#Path for the Reports Html Folder#
    tags= {"@smoke,@login"})#Declaring multiple Feature names of files#

-- Cheers

Solution 2

The features path must be relative to your project classpath. For example it can look like this:

@CucumberOptions(features = {"classpath:features_folder1", "classpath:features_folder2"}, ...)

or

@CucumberOptions(features="src/test/resources")
Share:
20,671
sri
Author by

sri

Updated on December 13, 2020

Comments

  • sri
    sri over 3 years

    When I submit a single feature file it works perfectly. I want to pass features folder path which has multiple feature files into runner script. Can anyone help to execute multiple feature files?

    All feature files have same steps but data is different and file name is different.

    @RunWith(Cucumber.class)
    
    @CucumberOptions(format = {"pretty"}, features =
    "C:\\TESTER\\Execution\\uidata\\featurefiles\\",
            glue={"com.test.auto.stepdefs"},dryRun=false) 
    
    public class CucumberTest { 
    
    }
    

    I appreciate you help.