For now I have a config.properties
file and a singleton configuration object, which reads the file to a map and then puts all the system variables there as well. So when I run my tests via Jenkins, job's parameters with the same name will override values, set in config.properties
file.
This is expected and correct behavior for me.
But I'd like to keep all the configuration and build parameters in GebConfig.groovy
file.
So two questions here:
Now, if I need to get GebConfig property in my code, I use
browser.getConfig().getRawConfig().get("contextPath")
. Is it proper call or there is better way to get params from config in tests' code?How to implement passing Jenkins job's parameters to Geb configuration? I got only the idea to search for it in
System.getenv()
first:public String getProperty(String name) { Map<String, String> systemEnv = System.getenv(); return systemEnv.get(name) ?: browser.config.rawConfig.get(name); }