Multiple choice technology testing

How to load user defined environment variables from file to QTP dynamically

  1. ObjectRepositories.Add

  2. Environment.LoadFromFile

  3. ExecuteFile

  4. SystemUtil.Run

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The Environment.LoadFromFile method dynamically loads user-defined environment variables from an external XML file into QTP at runtime. This allows test scripts to use different environment configurations without hardcoding values.

AI explanation

In QTP/UFT, the built-in method Environment.LoadFromFile(path) is used to dynamically load user-defined environment variables from an external file (like an XML) into the test's Environment collection at runtime. 'ObjectRepositories.Add' relates to attaching object repositories, not variables; 'ExecuteFile' runs a script file rather than loading variables; and 'SystemUtil.Run' launches external applications — none of these load environment variable definitions.