Greetings,
I am trying to create a test where certain steps of that test will only run if the browser is a certain browser. I created a coded step to assert whether or not the browser is Fire Fox, and I was wondering if there is a way that I can use that within the built in if...then logical step included in Test Studio. If not, is there another way that I can achieve this action?
Thank you for any advice you can offer.
Tyler
I am trying to create a test where certain steps of that test will only run if the browser is a certain browser. I created a coded step to assert whether or not the browser is Fire Fox, and I was wondering if there is a way that I can use that within the built in if...then logical step included in Test Studio. If not, is there another way that I can achieve this action?
Thank you for any advice you can offer.
Tyler
4 Answers, 1 is accepted
0
Hi Tyler,
Anthony
the Telerik team
This is easily accomplished without code or a logical step.
Highlight a step and go to the Properties Pane. Under the "Misc" heading, locate the "RunsAgainst" property and change it to the desired browser type.
Anthony
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Hi Tyler,
Anthony
the Telerik team
You can do this in code as well. See this page for an example.
Greetings,Anthony
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Tyler
Top achievements
Rank 1
answered on 26 Oct 2011, 09:28 PM
Thank you for the help Anthony.
Using the RunsAgainst property option for each step worked. With your coded solution, I have used something like that in different parts of my tests where it was a small action to be run for each browser. The problem with that approach for my issue is I want to run approximately 5 test as steps and 10 other steps if the browser is IE, so I was hoping to be able to use the logical if...then...else option in Test Studio so I could just drag all of those steps in to the 'if'. Not sure if this could be a possible enhancement where we can set the coded step to be recognized as a verification and then use is as part of the if...just a thought - it would be easier than having to change the property of many steps in test and easier to see what the test was doing when looking at it rather than having to click each step to see it's properties. Either way, the initial issue I was having is solved.
Thanks,
Tyler
Using the RunsAgainst property option for each step worked. With your coded solution, I have used something like that in different parts of my tests where it was a small action to be run for each browser. The problem with that approach for my issue is I want to run approximately 5 test as steps and 10 other steps if the browser is IE, so I was hoping to be able to use the logical if...then...else option in Test Studio so I could just drag all of those steps in to the 'if'. Not sure if this could be a possible enhancement where we can set the coded step to be recognized as a verification and then use is as part of the if...just a thought - it would be easier than having to change the property of many steps in test and easier to see what the test was doing when looking at it rather than having to click each step to see it's properties. Either way, the initial issue I was having is solved.
Thanks,
Tyler
0
Hi Tyler,
Kind regards,
Anthony
the Telerik team
I'm glad your issue is solved.
You're correct; you cannot use a coded step for the qualifying verification in a Test Studio If/Else logical step. You can, however, use the following lines in a coded step to execute a sub-test based on browser type:
if
(ActiveBrowser.BrowserType == BrowserType.InternetExplorer)
{
this
.ExecuteTest(
"Bing.tstest"
);
}
else
if
(ActiveBrowser.BrowserType == BrowserType.FireFox)
{
this
.ExecuteTest(
"Ask.tstest"
);
}
else
{
throw
new
ApplicationException(
"Unknown browser type"
);
}
Kind regards,
Anthony
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items