Using a configuration file to manage test environments

As shown in the previous recipe, it is possible to read variable values from an .ini file. We will show how to define several environments within such a file and load the input data for the current environment during runtime.

Getting ready

Follow the same steps stated in the Getting ready section of the Reading values from an INI file recipe.

How to do it...

Create a new file with the name QA-env-settings.ini. Enter the following entries to create three sets of parameters corresponding to three test environments QA1, QA2, and QA3:

[QA1] InputDataSrc= "RegressionData1.xls" Username = "user1" URL = "http://www.url1.com" Description = "Data for QA1 environment" [QA2] InputDataSrc= "RegressionData2.xls" ...

Get Advanced UFT 12 for Test Engineers Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.