So what we're really talking about here is maven filtering and profiles. I had a quick skim, and this looks like a reasonable example blog of how it works:
(we do something similar here - but slightly different, we wrote a custom maven plugin to help us deal with properties, but the effect is the same).
In this instance we use a separate config file to tell the runner how to run (local or hub):
String testSetup = getProperties().getProperty("test.setup");
WebDriver driver = null;
if (testSetup == null || testSetup.equals("local") || "${test.setup}".equals(testSetup)) {
logger.info("running locally due to conf: " + testSetup); FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.setPreference("app.update.enabled", false);
// AUM Set to: Minor Releases: Major Releases:
// 0 download no prompt download no prompt
// 1 download no prompt download no prompt if no incompatibilities
// 2 download no prompt prompt
firefoxProfile.setPreference("app.update.mode", 2);
firefoxProfile.setEnableNativeEvents(true);
driver = new FirefoxDriver(firefoxProfile);
} else {
logger.info("running on hub due to conf: " + testSetup); DesiredCapabilities capability = DesiredCapabilities.firefox();
try {
} catch (MalformedURLException e) {
driver = null;
e.printStackTrace();
}
}
Where the test.setup property comes from a config file that has been replaced with the correct property for our environment.
Does that help provide a path? it would mean multiple maven runs to run the different configurations (with a different property set each time), but hopefully this helps?