How to set serenity property at run-time??

2,732 views
Skip to first unread message

Kamini Karakoti

unread,
Sep 4, 2017, 11:24:53 PM9/4/17
to Serenity BDD Users Group
Want to change value of a serenity property at run time.
Reading the property as below:
SerenityVar serenityVar = SerenityVar.getInstance();
EnvironmentVariables variables = serenityVar.getSerenityProps();
variables.getProperty("webdriver.base.url");

However, at run-time, want to change the value of "webdriver.base.url"

Tried using
variables.setProperty("webdriver.base.url", "neWValue");
but did not work


John Smart

unread,
Sep 6, 2017, 11:28:04 AM9/6/17
to Kamini Karakoti, Serenity BDD Users Group
Environment variable are immutable, since changing them could have very adverse effects on multi-threaded testing, and you can't know where the values have already been used. Why do you want to change the base url at runtime?

--
You received this message because you are subscribed to the Google Groups "Serenity BDD Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to thucydides-users+unsubscribe@googlegroups.com.
To post to this group, send email to thucydides-users@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
___________________________________________________
John Smart | Wakaleo Consulting  |  +44 7398 832273
Making smart teams collaborate better
http://johnfergusonsmart.com  |  john....@wakaleo.com
___________________________________________________

We love breaking down silos and helping smart teams collaborate better! Ask about our tailored on-site workshops in Agile Product Planning, BDD Requirements Discovery,  BDD, TDD and Clean Coding, and Advanced BDD Test Automation.

Need some help with Serenity BDD? Check out our Serenity BDD training and support packages here.
___________________________________________________

shemiaki...@gmail.com

unread,
Mar 19, 2019, 6:25:38 AM3/19/19
to Serenity BDD Users Group
For example: i have Jenkins job with java + serenity auto-tests. I set which web driver tests should use in serenity.properties. Then i want run tests with another web driver. In Jenkins job i can add some run-time properties to configure each run. But when i`m using serenity all configuration is stored in serenity.properties. Does some way to do this exists?

среда, 6 сентября 2017 г., 18:28:04 UTC+3 пользователь John Ferguson Smart написал:
Environment variable are immutable, since changing them could have very adverse effects on multi-threaded testing, and you can't know where the values have already been used. Why do you want to change the base url at runtime?
On 5 September 2017 at 04:24, Kamini Karakoti <k.kar...@gmail.com> wrote:
Want to change value of a serenity property at run time.
Reading the property as below:
SerenityVar serenityVar = SerenityVar.getInstance();
EnvironmentVariables variables = serenityVar.getSerenityProps();
variables.getProperty("webdriver.base.url");

However, at run-time, want to change the value of "webdriver.base.url"

Tried using
variables.setProperty("webdriver.base.url", "neWValue");
but did not work


--
You received this message because you are subscribed to the Google Groups "Serenity BDD Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to thucydides-use...@googlegroups.com.
To post to this group, send email to thucydid...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Hemant Singh

unread,
Mar 19, 2019, 6:31:08 AM3/19/19
to shemiaki...@gmail.com, Serenity BDD Users Group
I think you can send as command line argument like this :

"-Dserenity.driver.capabilities='webdriver.base.url:newValue;shouldUseSingletonTestManager:true'"


Reply all
Reply to author
Forward
0 new messages