I am using cucmber+selenium. Is there a way i can pass options to @Cucumber.Options dynamically. Something like-
features="src/YahooSearch.feature"
// i want to take this feature file names from excel & put here...
I am using cucmber+selenium. Is there a way i can pass options to @Cucumber.Options dynamically. Something like-
features="src/YahooSearch.feature"
// i want to take this feature file names from excel & put here...
One way of setting it is through the System.setProperties()
method.
Say, if my resources/features
folder has all the necessary features, I can simply instruct Cucumber to scan for all the features in the folder like,
String features = "/src/main/resources/features";
System.setProperty("cucumber.options", features);
Also, you can instantiate your RuntimeOptions dynamically like
new RuntimeOptions(features);
Instead of using Junit, use TestNG to invoke feature files. The flow goes like, Read from Excel and with the data generate testng XML suite dynamically to invoke each feature file. Please find the reference below,
https://github.com/sahajamit/cucumber-jvm-testng-integration