Data format extensions (DFEs) overview
Data format extension (DFE) support enables easier scripting of web applications by providing the ability to decode and encode formatted data that is exchanged between the client and the server. This enables easier correlation and parameterization of the generated Vuser scripts.
Applies to:
-
Web - HTTP/HTML Vuser scripts
-
SAP - Web Vuser scripts
When to use DFEs
When you record a Vuser script, VuGen records the HTTP requests and responses that are passed between the client and web server. The data in these HTTP requests and responses is often encoded. For example, some of the data may be in binary format. The encoded data may be in the HTTP query string, headers, body, or cookies. When the encoded data is included in a Vuser script, the resulting script will contain data that is difficult to decipher. This makes it difficult to identify text strings that can be used for parameterization and correlation.
LoadRunner Professional uses data format extensions (DFEs) to resolve the difficulties that arise from encoded data in Vuser scripts. DFE support allows easier creation of Vuser scripts by providing the ability to decode the encoded data that is exchanged between the client and the server. By providing the decoded format of the data, the information is presented in the Vuser script in a readable format that enables you to correlate and parameterize the script as required. When the script is replayed, the DFE support re-encodes the modified Vuser script, and enables the Vuser to send the correctly encoded request to the server.
When a DFE is applied to a Vuser script and the script is then regenerated, the DFE modifies the script and replaces the encoded data with decoded data.
LoadRunner Professional includes a number of pre-defined DFEs. Each DFE is able to decode and encode a specific type of data. For example, the GWT-DFE decodes GWT data to XML format when a script is generated, and it encodes XML-formatted data to GWT-formatted data before the script is replayed (see Example of code generated with and without GWT-DFE support).
For a full list of the pre-defined DFEs, see Data format extension list.
How DFEs are applied
You enable DFE support for each Vuser script that requires decoding of encoded data. When DFE support is enabled, the DFE support is applied in the following circumstances:
-
Each time the script is generated (after recording) or regenerated. The DFEs are applied to decode the data to produce a script that is easy to understand and work with.
-
Each time the script is run. The DFEs are applied to re-encode the decoded data to produce HTTP messages with encoded data in a format that is expected by the server.
Note: In addition to applying DFEs when a script is generated or replayed, it is possible to apply a DFE to a selected string in a Vuser script. For details, see How DFEs modify a Vuser script.
In some scenarios, decoding of encoded data must be performed in a number of stages, until the fully decoded data is produced. Each stage in the conversion process is performed by applying a specified DFE. For example, encoded data from a response may be decoded by applying three DFEs - first DFE-1, then DFE-2, and then DFE-3. In each stage, the output from one DFE is the input to the next DFE, until the fully decoded data is produced.
DFE chains
The series of DFEs that are required to decode encoded data is defined in a chain. For example, you could create a chain called DFE-chain-1 that includes three DFEs: DFE-1, DFE-2, and DFE-3. The sequence of the DFEs inside a chain is significant—the sequence indicates the order in which the DFEs are applied to the encoded data.
DFE-chain-1:
If only a single DFE is required to decode encoded data, the DFE must still be included in a chain.
DFE-chain:
Assigning DFE chains
HTTP messages can be divided into a number of sections, including a body, headers, cookies, and a query string. After you define the DFE chains that will be applied to decode and encode a Vuser script, you must specify to which sections of the HTTP messages the DFE chains apply. Because each HTTP message has only one Body section and one Query String section, you can specify only a single DFE chain to apply to each of these sections. In contrast, each HTTP message can contain numerous headers and cookies. Consequently, you can specify a particular DFE chain to apply to each header and cookie.
Implement DFE support
To implement DFE support for a Vuser script, you perform the following steps:
Step 1 | Define a DFE chain |
Step 2 | Enable and configure DFE support |
Step 3 | Apply DFE chains |
Replay Vuser scripts that contain DFEs
When you replay a Vuser script that contains DFE functionality, various messages are added to the Replay log in VuGen's Output pane. Make sure to check these messages to ensure that the DFE functionality is correctly implemented. For further details, see Data format extension (DFE) troubleshooting .
See also:
- For details on using the VuGen JavaScript Engine to encode and decode data using common JavaScript libraries, see Using the VuGen JavaScript engine.
- For details on creating custom DFEs (for advanced users), check the Knowledge Base, available here: Software Support site.