Forum Discussion

Naureen's avatar
Naureen
New Contributor
8 years ago

One testcase for two different URLS

Is it possible to design one test case that test a web applications against two different urls depending on  which url user navigates to? I am working on creating some keyword test but I want to use the same  test for QA URL as well as customer's URL. How can I configure the name-mapping of TC to take care of this?

  • 1. Avoid using object properties that include the URL

    2. If you need to have this then you can use the wild card astrix to replace the part that is different between the URLs.

    Example, change

    https://qasite.yourcompany.com/index to

    https://*.yourcompany.com/index

     

    When opening the site you can put the URL in a project variable.

     

    Here is an example of code we use

     

      Browsers.Item(btIExplorer).Run();
      var browser = Sys.Browser("*");
      var Page1 = browser.Page("*");
      Page1.Wait();
      Sys["Browser"]("*")["BrowserWindow"](0)["Maximize"]();

      var TestSiteURL = Project["Variables"]["SiteURL"];
      Browsers.CurrentBrowser.Navigate("https://"+TestSiteURL);

  • kevin_kapell's avatar
    kevin_kapell
    Frequent Contributor

    1. Avoid using object properties that include the URL

    2. If you need to have this then you can use the wild card astrix to replace the part that is different between the URLs.

    Example, change

    https://qasite.yourcompany.com/index to

    https://*.yourcompany.com/index

     

    When opening the site you can put the URL in a project variable.

     

    Here is an example of code we use

     

      Browsers.Item(btIExplorer).Run();
      var browser = Sys.Browser("*");
      var Page1 = browser.Page("*");
      Page1.Wait();
      Sys["Browser"]("*")["BrowserWindow"](0)["Maximize"]();

      var TestSiteURL = Project["Variables"]["SiteURL"];
      Browsers.CurrentBrowser.Navigate("https://"+TestSiteURL);