-
Notifications
You must be signed in to change notification settings - Fork 99
Setting a system wide default base URL
wakaleo edited this page Jun 7, 2011
·
1 revision
Setting a system-wide the default base URL
You can set the default base URL for a Thucydides test in a number of ways. In the following test case, the default URL will be "http://www.google.com":
@RunWith(ThucydidesRunner.class)
public class SamplePassingScenario {
@Managed
public WebDriver webdriver;
@ManagedPages(defaultUrl = "http://www.google.com")
public Pages pages;
@Steps
public SampleScenarioSteps steps;
@Test
public void happy_day_scenario() throws Throwable {
steps.stepThatSucceeds();
steps.stepThatIsIgnored();
steps.stepThatIsPending();
steps.anotherStepThatSucceeds();
}
}
This way, when the test starts (or when you call pages.start() explicitly), the browser will open to the default base URL.
This is useful for unit testing, so that you can run the test in isolation directly from the IDE. However, when running these tests on different environments, you may want to override all of the default URLs to a different value. You can override the default base URL by using the webdriver.base.url system property. From the command line, you can override this using the -D command line option:
$mvn test -Dwebdriver.base.url=http://www.wikipedia.org