Forum Discussion

hfpg2001's avatar
hfpg2001
New Contributor
8 years ago
Solved

how to change the url in a test case

Hello, I have been building a lot of test cases in local Env. Now I want to launch it against another environment. I just change the URL browser to a variable. The problem is when the test case is ex...
  • kevin_kapell's avatar
    8 years ago

    You will need to change your namemappings because they likely have the URL in them.

    For example your URL could be https://devenvironment.mycompany.com

    This would be changed to https://*.mycompany.com

    The * is a wild card.

    In this way the scripts will work for any site as long as the rest of the URL is correct. You can then set a global variable for us in your scripts to open a broser to a particular URL.

    In the past I have edited the NameMapping file in notepad++ and did a global find/replace. I recommend making a backup copy of the file before doing this.

     

     

  • hfpg2001's avatar
    hfpg2001
    8 years ago

    Thanks both of you. I am already changed the URL at page object in the namemappin. But this wont fix everything becuase inside some pages are hiperlinks with the url hardcoded, Is there any way to change all the URL at once?

     

    Thanks.

  • shankar_r's avatar
    shankar_r
    8 years ago

    No, You can't make it at one step.

     

    But, You can try below steps,

     

    1. Create project variable like environmentURL.

    2. Store the URL with * appended in both sides like as "*te.env.com*"

    3. Add this variable into all of your objects which has your URL.

     

    Then you will be able to access the objects. 

     

    Note: Some objects mayhave unique URL to identify the page like te.env.com\testpage if you use above steps all pages treated in the sameway