Environment Object

Description

Enables you to work with environment variables.

You can set or retrieve the value of environment variables using the Environment object. You can retrieve the value of any environment variable. You can set the value of only user-defined, environment variables.

Methods and Properties

Method ExternalFileNameReturns the name of the loaded external environment variable file specified in the Environment pane of the Test Settings dialog box.
Method LoadFromFileLoads the specified environment variable file.
ValueSets or retrieves the value of environment variables.

Back to top

ExternalFileName Property

Description

Returns the name of the loaded external environment variable file specified in the Environment pane of the Test Settings dialog box. If no external environment variable file is loaded, returns an empty string.

Syntax

Environment.ExternalFileName

Back to top

LoadFromFile Method

Description

Loads the specified environment variable file. The environment variable file must be an XML file using the following syntax:

<Environment>
    <Variable>
        <Name>This is the first variable's name</Name>
        <Value>This is the first variable's value</Value>
    </Variable>
</Environment>

For more details about environment variable files, see the UFT One User Guide.

Syntax

Environment.LoadFromFile bstrFileName

Argument

Type

Description

bstrFileName

String

The name of the environment variable file to load.

Back to top

Value Property

Description

Retrieves the value of environment variables. You can retrieve the value of any environment variable. You can set the value of only user-defined environment variables.

Syntax

To set the value of a user-defined, environment variable:

Environment.Value(bsName) = var_Value

To retrieve the value of a loaded environment variable:

var_Value = Environment.Value(bsName)

Argument

Type

Description

bsName

String

The name of the environment variable.

Back to top

See also: