cancel
Showing results for 
Search instead for 
Did you mean: 

How to run Keyword tests in different urls.

SOLVED
rauny
Occasional Contributor

How to run Keyword tests in different urls.

Hi guys,



I need some advice to adjust my Keyword Tests. I've already recorded my tests, and that worked fine. But, now I need to run the same tests in different Urls.



I've tried creating a variable in the project, and setting the value with that variable.



New Url: "http://localhost:7003/administracao/login/loginPage.xhtml"



After this, I run the test again, the web browser page is open in the new address, but the tests didn't work, because the actions, for example, set text login, saved the previous address for the action:



NameMapping.Sys.Browser().Page("http://localhost:8080/administracao/login/loginPage.xhtml").Panel(0).Panel(0).Panel("idLoginPanel").Panel(1).Panel("contentLogin").Form("form_login").Panel(0).Textbox("j_username")



I need to change one by one? I've tried changing to (Url) but that didn't work too.



NameMapping.Sys.Browser().Page(Url).Panel(0).Panel(0).Panel("idLoginPanel").Panel(1).Panel("contentLogin").Form("form_login").Panel(0).Textbox("j_username")



Can you guys help me?



Thanks.



1 ACCEPTED SOLUTION

Accepted Solutions
tristaanogre
Community Hero

RE: How to run Keyword tests in different urls.

Without using namemapping, it's a bit trickier.  You most likely will not be able to retain your recorded steps.  You may need to re-construct your keyword test.  Basically, you'd need to do something like



  1. Use the Call Object Method test action to call the ToURL method on the Sys.Browser() object, passing in the URL variable to the method.


  2. Add in your On Screen actions manually... when prompted for the page object (NameMapping.Sys.Browser().Page()) enter an asterisk (*) for the page URL.  This will take whatever page you have up.


Honestly, it's a LOT easier if you at least map your page and then set the URL value on your page to be your project variable for the URL.



Now, based upon your original post, it LOOKS like all you are changing in the URL is the port number.  In which case, step 1 above may be all that is necessary to open up your initial URL.   Then you can double click on each action and just replace the port number in your action with the asterisk.



Hope this helps.

Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

4 REPLIES 4
tristaanogre
Community Hero

RE: How to run Keyword tests in different urls.

Since you have a project variable already set up for your URL, you've made it easy on yourself.  



What you'll need to do is go into your NameMapping, find the Page object (assuming it's mapped since you are using NameMapping in your example), and edit the URL property.  Set the property to be a "Project Variable" and select your URL variable.



Let me know if this helps.  Screenshot attached

Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
rauny
Occasional Contributor

RE: How to run Keyword tests in different urls.

Hi Robert,



I'm sorry but I'm not using mapping objects. I've unchecked the options, image attached.



I've tried changing to use the variable Url, and the browser opens in the new Url, but in the event set text it didn't work, because the event was saved with the previous Url.



Is there a way to change all the urls in the project without using mapping objects?
tristaanogre
Community Hero

RE: How to run Keyword tests in different urls.

Without using namemapping, it's a bit trickier.  You most likely will not be able to retain your recorded steps.  You may need to re-construct your keyword test.  Basically, you'd need to do something like



  1. Use the Call Object Method test action to call the ToURL method on the Sys.Browser() object, passing in the URL variable to the method.


  2. Add in your On Screen actions manually... when prompted for the page object (NameMapping.Sys.Browser().Page()) enter an asterisk (*) for the page URL.  This will take whatever page you have up.


Honestly, it's a LOT easier if you at least map your page and then set the URL value on your page to be your project variable for the URL.



Now, based upon your original post, it LOOKS like all you are changing in the URL is the port number.  In which case, step 1 above may be all that is necessary to open up your initial URL.   Then you can double click on each action and just replace the port number in your action with the asterisk.



Hope this helps.

Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

rauny
Occasional Contributor

RE: How to run Keyword tests in different urls.

Hi Robert,



I've changed to use * in the Sys.Browser().Page("*") and this solved my problem.



Now, all I have to do to run in differents urls is change the variable Url in the project (one time).



I've used * because my urls will change the port number and the address too.



Thank you so much! 🙂



New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors