Parameterizing Virtual User Scripts

The data within data sources is accessed by virtual users (VUs) via the VU methods available within the various Data Dictionary APIs.

Parameterizing Virtual User Script Code

Parameterization, whether automatic or manual, results in method calls from the aforementioned APIs being inserted into script code.

Note: No matter what type of data source is being accessed (other than custom data files), the method calls are exactly the same.

Example Parameterization Code

The following code examples demonstrate how strings (text) can be retrieved from a data source. All of these examples work whatever the data source type (custom data files excluded).

C# Examples:

// original recorded values in a Web Virtual User Script

form_52_0_1.GetInputElement("fullName").Value = "Martin Petrov";

form_52_0_1.GetInputElement("password").Value = "p@ssw0rd1";

form_52_0_1.GetInputElement("username").Value = "Martin";

 

// parameterized values

form_52_0_1.GetInputElement("fullName").Value = GetString("custForename") + " " + GetString("custSurname");

form_52_0_1.GetInputElement("password").Value = GetString("custPassword");

form_52_0_1.GetInputElement("username").Value = GetString("custForename");

Java Examples:

// original recorded values in a Web Virtual User Script

form_52_0_1.getInputElement("fullName").setValue("Martin Petrov");

form_52_0_1.getInputElement("password").setValue("p@ssw0rd1");

form_52_0_1.getInputElement("username").setValue("Martin");

 

// parameterized values

form_52_0_1.getInputElement("fullName").setValue(getString("custForename") + " " + getString("custSurname"));

form_52_0_1.getInputElement("password").setValue(getString("custPassword"));

form_52_0_1.getInputElement("username").setValue(getString("custForename"));

 

This topic was last updated on January 13, 2022, at 02:42:23 PM.

Eggplant icon Eggplantsoftware.com | Documentation Home | User Forums | Support | Copyright © 2022 Eggplant