Dynamic webdriver.base.url

1,499 views
Skip to first unread message

Grégory Bougeard

unread,
Jan 28, 2013, 10:42:45 AM1/28/13
to thucydid...@googlegroups.com
Hi,

I have to modify my thucydides tests for a new environment on which the webdriver.base url will be dynamic.
I will have urls like http://id.dev/foo where id will vary.
id might be in a data file for Parameterized jobs.

I think it's not possible out the box to handle this case, isn't it?

m.dolinin

unread,
Jan 28, 2013, 10:50:48 AM1/28/13
to thucydid...@googlegroups.com
Hi,
Please write more details to your question. 
What you mean  "id will vary" ? Host will change during one test or in different test-suites, you want to use different host?


понедельник, 28 января 2013 г., 17:42:45 UTC+2 пользователь Grégory Bougeard написал:
понедельник, 28 января 2013 г., 17:42:45 UTC+2 пользователь Grégory Bougeard написал:

Grégory Bougeard

unread,
Jan 28, 2013, 11:27:49 AM1/28/13
to thucydid...@googlegroups.com
As I said, I might have a csv file which contains differents ids and wihch should be applied in the base url.

my base.urls could be :

for a file like this :
ID,LOGIN,PWD
1,user1,pwd1
2,user2,pwd2

m.dolinin

unread,
Jan 28, 2013, 12:09:31 PM1/28/13
to thucydid...@googlegroups.com
As I uderstand your issue, you can use this feature http://thucydides.info/docs/thucydides-one-page/thucydides.html#_data_driven_testing_using_csv_files and @Before annotation for JUnit.
Something like this:
...
@ManagedPages
public Pages pages;
@Before
public void set_preconditions_for_data_driven_test() {
String newBaseUrl = "http://" + getId() + ".dev/foo";
pages.getConfiguration().getEnvironmentVariables().setProperty(ThucydidesSystemProperty.BASE_URL.getPropertyName(), newBaseUrl);
}
@Test
public void data_driven_test() {
pages.get(AnyPage.class).open();
}
...
Reply all
Reply to author
Forward
0 new messages