Quick test professional

QTP Tips QTP codes QTP Faqs and more

How to specify the environment variables to be loaded when QTP is started

You can either define individual values in the .vbs file or specify an environment file to load.

Here is what the .vbs file could look like:

Dim App ‘As Application

‘ Launch QTP
Set App = CreateObject(“QuickTest.Application”)
App.Visible = True

‘ Load an INI file with user-defined parameters
App.Test.Environment.LoadFromFile “C:\Test_Params\environment_file1.ini”

‘ Set the value of a specific user-defined Environment variable
App.Test.Environment.Value(“newvariable”) = “new value”

As you can see from the example, the Environment variable file is actually an .ini file. The structure would be:


There are several other options and settings you can set using the Automation Object Model. You can find documentation on this feature in the Documentation section on the Customer Support website. You do need to use QuickTest Professional 6.5 in order to use the Automation Object Model.



February 14, 2008 - Posted by | Automation Object Model For QTP | , , , , ,


  1. Hi,
    You given the information thats very useful. But you have to give some of the scripts for web testing concepts using qtp. its very helpful for us.


    Comment by manohar | April 4, 2008 | Reply

  2. our youtube videos of skimmers and pinpads; rip off the banks. 🙂

    Here is a link to our catalog file

    or see http://www.dfpublic.net for more photos, details, content and instructions on how to contact us

    email : darkforum@safe-mail.net
    MSN : darkforum@safe-mail.net
    ICQ : 160961
    icq for support : 911451

    Comment by skimerszz | July 12, 2009 | Reply

  3. Hi,

    Regarding environment variable, yes i can able to create Inbuild and also external in XML file.

    (1) In XML file i don’t want to assign a value of Ver1 and would want to assign it in test script itself but it won’t allow me to do that….can you please give the details of environment variable creation and actual live use in Framework
    (2) Can you give the details how can i build up Hybride Framework with XML or INI (environment variable) for Website…as i am new to this.

    Thanks in advance for the cooperation.


    Comment by shrinivas | February 28, 2010 | Reply

  4. is it possible to set environment variable value by taking value from input box …..

    and also tell me the script how to set environment variable and export the same to xml file …..
    thanks in advance

    Comment by chetan | May 9, 2011 | Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: