Difference Execution Options

Ask general questions here.
jrob3rts
Posts: 10
Joined: Fri Sep 06, 2013 10:52 am

Difference Execution Options

Post by jrob3rts » Fri Sep 13, 2013 2:40 pm

Hi,
I am testing a site against:
1. Several Browsers
2. Several client settings
Most of the functions are the same (say 95-98%), so I would like to reuse code where possible.

If there any way in which I can execute a test for Client A, against Browser 1, and have the scripts execute and flags or whatever be set that allow the right scripts, or parts of scripts to be run?

Challenges.....
FireFox, IE10 and Chrome have difference save as dialogues.
Client A will have a different title to Client B

James

omayer
Posts: 458
Joined: Thu Oct 28, 2010 6:14 pm

Re: Difference Execution Options

Post by omayer » Fri Sep 13, 2013 3:20 pm

using regular expression might work--

public static void CloseThreeBrowser(string BrowserInfo, string txtMessgae)
{

if(BrowserInfo=="Chrome"){

Button bttn = "/form[@title~'.*Google Chrome']/container[@accessiblename='Google Chrome']//tabpage[@accessiblename~'[A-Za-z0-9_]']/button[@accessiblename='Close']";
bttn.Click();
Delay.Ms(2000);


}
else if(BrowserInfo=="Firefox"){


MenuItem menu = "/form[@title~'.*Mozilla Firefox']/toolbar[@accessiblename='Menu Bar']/?/?/menuitem[@accessiblename='File']";
menu.Click();
Delay.Ms(2000);


MenuItem menuExit="/form[@title~'.*Mozilla Firefox']/toolbar[@accessiblename='Menu Bar']/?/?/menuitem[@accessiblename='File']/?/?/menuitem[@accessiblename='Exit']";
menuExit.Click();
Delay.Ms(2000);


}

Report.Success(BrowserInfo + txtMessgae);


}
Tipu

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Difference Execution Options

Post by Support Team » Mon Sep 16, 2013 4:16 pm

Hi,

Thanks for your input omayer!

There are different ways how such situations can be handled.
One would be using repository variables in combination with the data driven approach as described on the following blog: Cross-Browser Test Automation with Ranorex.

Regards,
Markus