Java cucumber: obtain @ cucumber options from external sources, such as property files
Whether it can be from Java Get the cucumber option value from the properties file?
In this so post, it shows that it is passed from the CLI
This is my sample class:
@RunWith(Cucumber.class) @CucumberOptions( features = {"resources/features/"},glue = {"classpath:com/"},tags = {"@foo,@bar"} ) public class UITestRunner { }
Instead of hard coding the code here, I want to get it from the properties file Any help is appreciated!
Solution
Cucumber will initially look for the api. cli. Parameters provided by main or @ cumberoptions
But you can override them (in this particular order):
>OS environment variable cucumber_ Options > java system properties Options > with cucumber Java resource pack for options attribute properties
Once one of the above options is found, it will be used Overwrite in a file named cucumber Options or cutter_ Options is provided in the variable (or attribute) of options All values except plug-in parameters will be overridden by cucumber api. cli. The value provided by main or @ cumberoptions Plug in options are added to the cucumber api. cli. In the plug-in specified by main or @ cumberoptions