Forum Discussion
obaid_shirwani
11 years agoContributor
I tried this:
1. In the nameMapping, I modified the Page URL's domain part with a wildcard (*) like this: "*/myApp/adminLogin.aspx"
2.a. I defined a Persistent Variable in the Projects Variables named domain and assigned it the domain address: "http://myDomain"
2.b. I defined another Persistent Variable in the Projects Variables named adminLogin and assigned it the adminLogins trail: "/myApp/adminLogin.aspx"
3. The adminLogin function goes like this:
function LoginMyApp()
{
var adminLoginURL;
Browsers.Item(btChrome).Run("chrome://newtab/");
adminLoginURL = Project.Variables.domain+Project.Variables.adminLogin;
Aliases.browser.ToUrl(adminLoginURL);
Aliases.browser.myAppAdminloginMain.formForm1.textboxEmployeeOid.SetText("admin");
Aliases.browser.myAppAdminloginMain.formForm1.passwordboxPassword.SetText("password");
Aliases.browser.myAppAdminloginMain.formForm1.submitbuttonLogincontrolLoginbut.ClickButton();
Aliases.browser.myAppAdminloginMain.Wait();
}
4.1. This is all working as desired.
4.2. NameMapping works correctly when the domain variable's value is changed.
4.3 Executing tests on all desired domains works by simply modifying the 'domain' variables value.
5. My question is: Is this the best practice or do we have a smarter way?
1. In the nameMapping, I modified the Page URL's domain part with a wildcard (*) like this: "*/myApp/adminLogin.aspx"
2.a. I defined a Persistent Variable in the Projects Variables named domain and assigned it the domain address: "http://myDomain"
2.b. I defined another Persistent Variable in the Projects Variables named adminLogin and assigned it the adminLogins trail: "/myApp/adminLogin.aspx"
3. The adminLogin function goes like this:
function LoginMyApp()
{
var adminLoginURL;
Browsers.Item(btChrome).Run("chrome://newtab/");
adminLoginURL = Project.Variables.domain+Project.Variables.adminLogin;
Aliases.browser.ToUrl(adminLoginURL);
Aliases.browser.myAppAdminloginMain.formForm1.textboxEmployeeOid.SetText("admin");
Aliases.browser.myAppAdminloginMain.formForm1.passwordboxPassword.SetText("password");
Aliases.browser.myAppAdminloginMain.formForm1.submitbuttonLogincontrolLoginbut.ClickButton();
Aliases.browser.myAppAdminloginMain.Wait();
}
4.1. This is all working as desired.
4.2. NameMapping works correctly when the domain variable's value is changed.
4.3 Executing tests on all desired domains works by simply modifying the 'domain' variables value.
5. My question is: Is this the best practice or do we have a smarter way?