I have been using set up method to launch site but it has made made it difficult for me to maintain tests, especially now when there are multiple URLs for application -
public void setUP() {
WebDriver driver = new FirefoxDriver();
driver.get("appURL")
}
Problem I face is that the application has two URLs for two different roles - Admin and normal User. Depending on the kind of URL I would do -
public void setUP() {
WebDriver driver = new FirefoxDriver();
if(appURL.contains("admin") {
driver.get("adminappURL")
} else {
driver.get("userURL")
}
}
URL is externalized to an xml file and tests are grouped in small set of tags depending on role, but there is overlapping at times. Hence There are instances when I need to log in to both admin and user facing site from one test. In this case I end up in launching adminURL first and then user facing URL to begin with test operations. Here launch of admin URL at first instance is unnecessary.
I am willing to know what others follow with their test automation. URL invocation in set up method or in individual tests?