javawindowsmacoscucumbertest-runner

In Cucumber, How to pass the location of the file path such that it works for both Windows and MAC


In Cucumber(mvn based java project) we need to specify the location of files (e.g) feature file location in the TestRunner as below

@CucumberOptions(features=("src\\test\\resources\\features"),
                 glue= {"com.testing.stepdefinitions"},
                 strict = true,
                 plugin= {"pretty","html:target/cucumber",
                         "com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:"}
                 )

public class MyRunner extends BaseClass{
}

How to specific the file path such that it works properly in Windows and MAC ?


Solution

  • Please try the following instead of src\\test\\resources\\features. This will work in both windows and Mac.

    @CucumberOptions(features=("./src/test/resources/features"),