cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to run my script in another environment.

sguda
Regular Contributor

Not able to run my script in another environment.

In my project for tested applications , in parameters i gave the command line as Command line: "https://qafa.fameinc.com/CallowayQA_P1/Login.aspx.



The test is running fine.



Now i want to run the test for another version of application with url Command line: "https://qafa.fameinc.com/CallowayQA_P2/Login.aspx .



So i went and changed the url in command line under the parameters with new url i want to run the test.



But it didn't change the value of iexplore step of TOURL  in the keyword test step to new url .

So i changed the TOURL  to new url https://qafa.fameinc.com/CallowayQA_P2/Login.aspx

But it is not running and looks like it is not mapping the objects correctly.



So how do i change the url to new version of application and run the same test.Please suggest the solution.
11 REPLIES 11
YMinaev
Staff

RE: Not able to run my script in another environment.

Hi,



Modify the URL for the Page object in your Name Mapping scheme - just replace the number in your URL with a wildcard.
------
Yuri
TestComplete Customer Care Engineer

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
sguda
Regular Contributor

RE: Not able to run my script in another environment.

Do i have to change the command line parameters in Tested apps also along with what you have suggested or i don't need to change in tested apps.
YMinaev
Staff

RE: Not able to run my script in another environment.

Hi,



You should modify the Name Mapping scheme, not TestedApps.
------
Yuri
TestComplete Customer Care Engineer

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
sguda
Regular Contributor

RE: Not able to run my script in another environment.

If i replace the number with wild card in the page object of the name mapping for the script and don't give the new url in the command line of parameters of Tested Apps then how does it know which url to run the script with , With old version url(P1) or new version url(P2).



Please suggest.

I tried this .I replaced the number in the page object url with wild card and changed the TestedApps command line parameters to new version url(P2). Tried to run. Initially it opened up IE with new url(P2) but switched back to older version url (P1)for the following steps as the iexplore , TOURL is still pointing to older version(..P1) url.



So i removed the step iexplore TOURL , then the test is running with new version(..P2) url



Please suggest me what to do.
YMinaev
Staff

RE: Not able to run my script in another environment.

Hi,



What's the problem exactly? Are you unable to run scripts when opening another URL or are you just not able to launch IE with the new URL at all? According to your first post, TC doesn't recognize the page having a new URL, and that's you need to change Name Mapping for.



To open another URL, store it anywhere in your script and either call the page's ToUrl method with it, or modify IE's command line before starting it.
------
Yuri
TestComplete Customer Care Engineer

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
sguda
Regular Contributor

RE: Not able to run my script in another environment.

Hi



I recorded the script with url https://qafa.fameinc.com/CallowayQA_P1/Login.aspx.

i changed the page object url in name mapping as https://qafa.fameinc.com/CallowayQA_P*/Login.aspx, Used wild card for P1.

I changed the command line as Command line: "https://qafa.fameinc.com/CallowayQA_P2/Login.aspx as i want to test with url which has P2 in it.

I tried to run the test , at first it opened IE with new version url which has P2 in it. But it switched back to  old version url with which i recorded the script originally https://qafa.fameinc.com/CallowayQA_P1/Login.aspx because in the keyword test

iexplore  TOURL is pointing to https://qafa.fameinc.com/CallowayQA_P1/Login.aspx.



So do i have to change the TOURL also in my every keyword test of my project.

If so i don't want to change TO URL in my every keyword test of my project back and forth to test with different versions of applications. Can you suggest a simple solution fo this



Thanks.
YMinaev
Staff

RE: Not able to run my script in another environment.

Hi,



If you open your page via IE's command line, you can remove ToURl from your test. It is not needed in this case (IE will open the URL itself).
------
Yuri
TestComplete Customer Care Engineer

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
smecham
New Contributor

RE: Not able to run my script in another environment.

Hello,



I have found when I use the recorder for web testing (both keyword and scripted tests) and then change the url from my www.test.com to www.production.com so that I can run the same test on the production site I must edit my recorded script and remove the ToURL calls that are added each time the web page loads to a new page.  If you don't do this and use your new URL to launch your test the first time it encounters one of the ToURL operations it will change back to the original URL.



Also another suggestion you should include iexplore.exe in your testedApps and set up a variable for the URL you are using to test using a ToURL opperation to go to the web page after launching the testedApp iexplore.exe.  This way you can set up a new Test Item and pass in the variable for your URL.  This way you can have 2 different test items one with the first URL and another with the second URL that can be ran with out having to change your testedApps.



You will still want to use a wild card in your NameMapping so TestComplete can see the objects on the tested pages.



Attached you will find a simple project that in test1 I have setup to use a variable to control which URL to test and in test2 you will find an example of the extra ToURL operations that will mess up your tests when using different URL's.



I hope this helps you with your issue.
mazhar555
Contributor

RE: Not able to run my script in another environment.

Hi, if u r using only script you can use the following code as well.



Sub Main()

Call browserLaunch()

Call ApplicationLaunch("http://www.automatedQA.com/forums")

End Sub



Sub browserLaunch()

    'call TestedApps.CloseAll

    Call TestedApps.IEXPLORE.Run()

    Delay(5000)

End Sub



Sub ApplicationLaunch(strURL)

  DIM  P,PAGE

  set p = Sys.Process("iexplore")

  set page = p.page("*")

  Call page.toURL(strURL)

  page.wait

End Sub



if u define this PAGE as a global variable then you can use it anywhere in your script.



Thanks!
-
Muhammad Mazhar Mahmood
Certified Software Tester (CSTE)
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors