In my Java selenium application for running automation testscripts, I want to integrate with Spring/Spring boot to use make use of .properties files for different environment to run. Is there any example or how to proceed, I have seen many links , but not able to find the correct way of implementing it. Depending on the environment the app is in, it should pick the corresponding .properties file.
ReadConfigurations.java // Where it should read the properties file and get some values like,
public class ReadConfigurations {
// @Value( "${local.driverpath}" )
// private String getdriverpath;
// @Value( "${login_name}" )
// String getLoginName;
}
application-local.properties
local.driverpath = ..\\chromedriver_win32\\chromedriver.exe
local.implicit_wait_time=30
local.app_url = http://localhost:8080/app
local.login_name=
local.login_password =
application-test.properties
local.driverpath = ..\\chromedriver_win32\\chromedriver.exe
local.implicit_wait_time=30
local.app_url = http://testurl:8080/app
local.login_name=
local.login_password =
public class LoginTest {
ReadConfigurations readConfigurations;
@Test
private void login() throws InterruptedException {
System.setProperty("webdriver.chrome.driver", readConfigurations.getDriverPath);
}
}