Forum Discussion

LeelaM's avatar
LeelaM
Occasional Contributor
5 years ago

Dynamic Url

Thank you to the Smearbear Support group for helping me move forward 

I have couple of questions, hope some one can answer them πŸ™‚ and thank you very much.

 

I want to use the same keyword test I have recorded for one environment (whose url looks like https://aa.abc.avista.edu/GRT/page)
in mutiple environments

this is how the urls looks in different environments
https://aa.abc.avista.edu/GRT/page
https://bb.abc.avista.edu/GRT/page
https://cc.abc.avista.edu/GRT/page

 

Q1) I have changed the navigate chrome browser value to https://*/GRT/page, but I am getting an error
This site can’t be reached
https://%2A/GRT/page
while running my keyword test

 

Q2) There are many objects that got recorded in the keyword script
eg: textusername, passwordbox, formloginform, link etc
each object has a property 'baseurl' value as 'https://aa.abc.avista.edu/GRT/page' under namemapping window

Do I have to edit the baseurl for each object to something like this
baseurl: https://*/GRT/page
for my keyword test to work on different urls? or is there a common area I can tell to use baseurl as https://*/GRT/page
for all the objects in the test?

  • Hi,

     

    Personally I would do it this way:

    a) Create a string project variable of temporary type (with default value, say, https://aa.abc.avista.edu/GRT/page);

    b) Depending on how you are going to execute your tests on another environments, consider how to assign the proper value to the above variable. Possible options: manually; from the command line as a custom parameter; read from configuration file; implement this or that data loop; etc.

    c) Modify test code that starts browser and performs initial navigation so that the code uses the value of the above temporary project variable (which, by that moment, must contain correct value);

    d) Revise NameMapping and remove site URL from the list of identification parameters for as many objects as possible. Investigate your tested application and find other unique, static and stable properties that can be used for this or that object identification and adjust NameMapping appropriately;

    e) For the objects where URL as an identification parameter is required or highly desirable (can't think about anything else but Page), edit its identification parameters so that instead of static hardcoded value this parameter referenced the abovementioned project variable.

     

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    Personally I would do it this way:

    a) Create a string project variable of temporary type (with default value, say, https://aa.abc.avista.edu/GRT/page);

    b) Depending on how you are going to execute your tests on another environments, consider how to assign the proper value to the above variable. Possible options: manually; from the command line as a custom parameter; read from configuration file; implement this or that data loop; etc.

    c) Modify test code that starts browser and performs initial navigation so that the code uses the value of the above temporary project variable (which, by that moment, must contain correct value);

    d) Revise NameMapping and remove site URL from the list of identification parameters for as many objects as possible. Investigate your tested application and find other unique, static and stable properties that can be used for this or that object identification and adjust NameMapping appropriately;

    e) For the objects where URL as an identification parameter is required or highly desirable (can't think about anything else but Page), edit its identification parameters so that instead of static hardcoded value this parameter referenced the abovementioned project variable.

     

    • sonya_m's avatar
      sonya_m
      SmartBear Alumni (Retired)

      Marsha, Alex, your input is appreciated!

       

      LeelaM Did you find the advice helpful? Please mark the best answer as a Solution