I'm trying to use SharedDriver instance as in supplied cucumber-jvm examples (defined in java-webbit-websockets-selenium' folder). So would it be correct to initialize the properties once in SharedDriver constructor:
public SharedDriver() {
super(REAL_DRIVER);
initProperties();
REAL_DRIVER.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
}
private void initProperties(){
properties = new Properties();
try {
properties.load(getClass().getResourceAsStream("/app.properties"));
} catch (IOException ex) {
LOGGER.error(ex.getMessage());
}
}
And get the properties later in no matter which Stepdefinition class as follows:
class MyStepDefinitions {
private Properties properties;
public MyStepDefinitions(SharedDriver driver) {
this.properties = driver.getProperties();
this.driver = driver;
}
}
Like that I'd be able to use properties all around the step definitions in the class. Or there is a better solution?