SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 3 of 3
  1. #1
    Member
    Join Date
    Jun 2004
    Location
    Cheltenham, UK
    Posts
    42
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Web Testing Multiple Environments

    Hi,

    A common probem I'm guessing but the QTP "help" is as great as usual.

    I have a test that is split into various scripts. The first script is a simple Login which has an inbuilt URL to open.

    How can I make the Login scripts use an external file so all scripts run on whichever (anyone of three) environments that could be tested?

    Any help much appreciated.

    Sandy
    Hmmm, I'll be needing a work around for that

  2. #2
    Member
    Join Date
    Jun 2004
    Posts
    84
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Web Testing Multiple Environments

    ' Controller action
    DataTable.Import("data.xls")
    row_num = Datatable.GetSheet("URL_sheet").getRowCount()
    For cnt = 1 to row_num
    Environment.Value("url_login") = DataTable("URL","URL_sheet")
    RunAction "Login [Login]", oneIteration
    RunAction "Logout [Logout]", oneIteration
    Datatable.SetNextRow
    Next

    ' In login action
    Browser("micClass:=Browser").Navigate Environment.Value("url_login")
    Browser("micClass:=Browser").Page("micClass:=Page" ).Sync
    ' Enter ID and pass...

    Did not test the code. Maybe buggy. Just the idea.

    Larry

  3. #3
    Moderator
    Join Date
    Sep 2001
    Location
    Doncaster, UK
    Posts
    5,788
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Web Testing Multiple Environments

    Sandy I use an external function to launch the relevant URL. The Environment ID is stored in an external Environments file as used by Larry.

    To run on a different Environment I just change the Environment ID in the external file, no need to change the function (unless the URLs change), here's the code:

    External File Contains
    ======================
    [Environment]
    runEnv=UAT1
    ======================

    Function Call
    =============
    Call LaunchURL(Environment("runEnv")
    =============

    Function
    ========
    Function LaunchURL(Env)
    ' Open Browser
    Set IE = CreateObject("InternetExplorer.Application")
    IE.Visible = true
    ' Set Correct URL
    Select Case Env
    Case "UAT1"
    siteURL = "http://www.UAT1.Com" ' UAT1
    Case "UAT2"
    siteURL = "http://www.UAT2.Com" ' UAT2
    Case "UAT3" siteURL = "http://www.UAT3.Com" ' UAT3
    End Select
    ' Navigate to Portal Homepage
    IE.Navigate SiteURL 'Open the appropriate URL
    Wait(2)
    End Function

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 06:15 AM.

Copyright BetaSoft Inc.