Konstantin
Top achievements
Rank 1
Konstantin
asked on 12 Mar 2013, 07:49 PM
I need to utilize BaseURL feature during playback, but instead of the actual BaseURL coming from any sort of test configuration I want to be able to calculate it in the code and stick the value to the test run for all subsequent test steps to use. Can I do that?
Or, otherwise, can I set BaseURL to use for playback in the data source (XML file) the test is bound to?
Thank you!
Konstantin
Or, otherwise, can I set BaseURL to use for playback in the data source (XML file) the test is bound to?
Thank you!
Konstantin
10 Answers, 1 is accepted
1
Accepted
Hello Konstantin,
You can override the BaseUrl property in a coded step like this:
Regards,
Plamen
the Telerik team
You can override the BaseUrl property in a coded step like this:
Regards,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Test Studio Trainings
0
Konstantin
Top achievements
Rank 1
answered on 18 Mar 2013, 05:16 PM
One thing I figured on my own is how to set BaseUrl from the data:
string baseUrl = Data["BaseUrl"].ToString();
Manager.Settings.Web.BaseUrl = baseUrl;
The part
Data["BaseUrl"]
is absolutely not documented and is terribly hard to discover. Please update the documentation for data binding.
Thank you!
Konstantin
string baseUrl = Data["BaseUrl"].ToString();
Manager.Settings.Web.BaseUrl = baseUrl;
Data["BaseUrl"]
is absolutely not documented and is terribly hard to discover. Please update the documentation for data binding.
Thank you!
Konstantin
0
Hi Konstantin,
Cody
the Telerik team
Data["BaseUrl"] will only work if you're running a data driven test and your data source includes a column named "BaseUrl". Otherwise you'll get this error:
System.ArgumentException: The extracted variable 'BaseUrl' does not exist in the store.
Cody
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Test Studio Trainings
0
Konstantin
Top achievements
Rank 1
answered on 18 Mar 2013, 06:29 PM
-- Data["BaseUrl"] will only work if you're running a data driven test and your data source includes a column named "BaseUrl".
Yes, of course! But it is exactly our scenario and it was impossible to discover that solution from documentation. Documentation never ever says anything about Data["..."]
Yes, of course! But it is exactly our scenario and it was impossible to discover that solution from documentation. Documentation never ever says anything about Data["..."]
0
Accepted
Hi Konstantin,
Cody
the Telerik team
We do have this documentation page specifically for using Data in code. There are many other code samples there as well.
Greetings,Cody
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Test Studio Trainings
0
Tim
Top achievements
Rank 1
answered on 19 Dec 2013, 10:15 PM
Plamen,
When you override the BaseUrl using the coded step method you mentioned:
does this only override the BaseUrl for this coded step? Or maybe does it override the BaseUrl for the rest of this test?
Thank you,
Tim
When you override the BaseUrl using the coded step method you mentioned:
does this only override the BaseUrl for this coded step? Or maybe does it override the BaseUrl for the rest of this test?
Thank you,
Tim
0
Hi Tim,
That line of code changes the global setting for the life of that one test. So yes it's for all steps, coded and non-coded from that point forward up until the particular test ends. Once the test ends, this in memory settings object is discarded.
Regards,
Cody
Telerik
That line of code changes the global setting for the life of that one test. So yes it's for all steps, coded and non-coded from that point forward up until the particular test ends. Once the test ends, this in memory settings object is discarded.
Regards,
Cody
Telerik
0
Tim
Top achievements
Rank 1
answered on 20 Dec 2013, 02:55 PM
Thank you Cody!
0
Gavin
Top achievements
Rank 1
answered on 20 May 2016, 11:13 PM
Another busted link...
0
Hello Gavin,
Please excuse us of the wrong link.
Here is the correct one.
Regards,
Boyan Boev
Telerik
Please excuse us of the wrong link.
Here is the correct one.
Regards,
Boyan Boev
Telerik