Results 1 to 10 of 10
  1. #1

    Script reusability

    Greeting All,
    I have recorded a script in Test Env, now i need to run the same in Dev, and Prod. Can anyone please guide me through the changes i need to make to do this.

  2. #2

    Re: Script reusability

    This is all depends on the framework you've used for QTP. Personally I set up an User Defined Environment XML file and open the application within the script.

    If you are using QTP to open the application then have a look at the Record and Run Settings.

  3. #3

    Re: Script reusability

    how do i set up the XML file.

  4. #4

    Re: Script reusability

    Setting up the xml has no effect unless your framework is geared up to use it.

    Within the Test Settings, there is an Environment tab. in this you can set user defined variables, which you can then download and import to/from an xml file.

    My framework uses a different xml file for each environment I test in. I then choose the one and which to test.

    Within in my script, I have functions which open the application. These use the values defined in the xml to decide which environment to run the test against.

    I must stress that this is just my own way of doing it. Also the use of the term "Environment XML" is purely coincendtal with the fact that I am using it to decide which environment I am testing in.

    Sorry if this is confusing. It's confusing me when I re-read it!

    I wish I didn't mention User Defined Environmental XML now! I think looking at Record and Run Settings will achieve what you want!

  5. #5

    Re: Script reusability

    Thanks Robbie,

    I did try changes to Record and Run, it gives me a "Parent Object not Found Error" when i try to run the test env script in Dev, is there any perticular settings i need to look into.


  6. #6

    Re: Script reusability

    I would suggest that the properties QTP is using to identify an object is not constant throughout the different environments.

    If you are using QTP Object Repository, then you need to identify these properties and use regular expressions or use different properties which are constant across each environment.

    You should be able to do this in OR Manager.

  7. #7

    Re: Script reusability

    OR Manager is empty, object properties are stored only in the repository. should i add the objects to OR Manager.

  8. #8

    Re: Script reusability

    I mighthave the wrong terminology (I haven't used OR in 9.1). Basically, you have to edit the OR.

  9. #9
    Join Date
    Sep 2001
    Doncaster, UK

    Re: Script reusability

    I use this, have an external Environment variable that contains an identifier for each environment:

    Function Logon2Portal()
    ' Open Browser
    Set IE = CreateObject("InternetExplorer.Application")
    IE.Visible = true
    ' Set Correct URL
    Select Case Environment("Environment")
    Case "UAT1"
    siteURL = "http://portal.uat1.com"
    Case "UAT2"
    siteURL = "http://portal.uat2.com"
    Case "UAT3"
    siteURL = "http://portal.uat3.com"
    Case "SIT1"
    siteURL = "http://portal.sit1.com"
    Case "SIT2"
    siteURL = "http://portal.sit2.com"
    Case "SIT3"
    siteURL = "http://portal.sit3.com"
    End Select
    ' Navigate to Portal Homepage
    IE.Navigate SiteURL 'Open the appropriate URL
    End Function

  10. #10

    Re: Script reusability

    Dim IE
    Dim ENV
    Dim siteURL

    Function OpenBrowser(ENV)
    Set IE = CreateObject("InternetExplorer.Application")
    IE.Visible = true

    Select Case ENV
    Case "Test"

    Case "Train"
    siteURL = "http://test_train/training.html"

    Case "DevBTS"
    siteURL = "http://test_train/developmentBTSServer.html"

    Case "DevBRS"
    siteURL = "http://test_train/developmentBRSServer.html"

    Case Else
    Reporter.ReportEvent micWarning,"Launch Browser","Environment Identifier "& Environment("ENV") & " Not valid"
    End Select

    IE.Navigate siteURL
    End Function

    On Error Resume Next

    ENV= "Test"
    RunAction "Run Application [Run Application]", oneIteration

    'ENV ="DevBTS"
    'RunAction "Run Application [Run Application]", oneIteration

    On Error Goto 0

    I used the Above Prog: it works fine and opens the required URL, but the "Dev" URL is not able to RUN, since the script was recorded in "Test" URL



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
BetaSoft Inc.
All times are GMT -8. The time now is 03:58 PM.

Copyright BetaSoft Inc.