Forum Discussion

markbain's avatar
markbain
Occasional Contributor
15 years ago

Name Mapping and changing URL host names

Hello,



I am a new user of TC 7.x.  I am testing a Web application, however the testing environment is hosted on several locations.  EG: There is a QA environment, along with a separate Regression/Performance environment.  The URL's to each is different only by the hosting portion of the URL ("portalQA.com/testapp/..." vs "prod-regression.com/testapp/...") . 



I would like to be able to use the same tests that I create in both environments.  However, I noticed that the recored tests all contain the environment I recorded them in, and if I run them in the other environment they do not work.  Is there a way to "*" out the host part of the URL?



thanks.

5 Replies

  • Hello Mark,



    You can do this in number of ways.




    Map your page from any environment into the namemapping using the finder tool. Make sure that you use the location property and class to map it and avoid URL property. Your applications page will be recognized what ever url it has on it now.




    If you want to use URL in the name mapping make, point the URL propertie's value to a project variable and change the project variable from your script depending on where you want to run your scripts.




    Use FindChild property to get the page and pass the URL value dynamically from the script depending on what you are expecting it to be.




    so on......




    Thankyou




  • markbain's avatar
    markbain
    Occasional Contributor
    Thank you for your response.  While I am still learning the application (TC) some of what you said I sort of understand, others I do not.



    I managed to find a way after I posted.  I went into the Mapping section, and in the top half I highlighted the 'page' in question.  On the right there is a list of the attributes that were associated with that mapped item, and it had 'URL'.  I edited the URL to have an '*' where the host section was and just left the '.com/...' part.(See attached)  I tested it using various environments and it worked.



    I don't know if this is a valid use of the software or proper functionality, but it is working for me.



    Again, thanks for the timely response.



  • What you have done is fine. If you ever find that wildcards are not sufficient, you can also use a Project Variable to define the URL. That can be done from the same place.

  • I have a related question that doesn't seem to be answered by the response to this one.



    What I'm trying to do is build a script that will go to a page where data is stored that developers used to build new webpages.  It would read data from that page to validate the pages they built.



    The page where the data is stored would be different on each run through the script, but it would always have the same format.



    Right now I'm just building the part where the system opens the page where the data is stored.  I know that the URL will always have the same BEGINNING part, but the end part will be different from one release to the next.



    I want the "IEXPLORE1" item, with the "ToURL" operation, to open a page with a variable value.  I tried storing the URL I wanted to test in a shortcut on the desktop, and ask TC to open that URL, but it still records the URL that TC opens inside the script.



    How can I control the "ToURL" operation dynamically?  Where can I store the data that TC will use to open the right page?



    Also, the page requires a login.  I've got the steps there to open the page, and then there's a "Wait" operation against an Item that is mapped to the specific page where the information is stored.  I want that wait to happen, but I don't know the precise URL that will be opened, necessarily, before the test is run.  I know the page where I'm recording the test, but when new pages are built I don't want to have to re-record all my scripts; that would defeat the purpose.
  • Hi Fred,


    I'm not sure that I understand what the current problem is. Could you please clarify why using wildcards to replace variable parts of URLs for object identification (e.g. www.mysite.com/mypage*) and using project variables in ToUrl method calls to change the tested web page dynamically does not suit your needs?