What is LoadRunner’s DFE Part 1 (XML)
Posted on Aug, 2016 by Admin
DFE is short for Data Format Extension. It is a feature added to LoadRunner back in version 11, but a lot of people don’t understand what it is and how it can help you. In simple terms DFE allows for easier LoadRunner scripting by allowing us to decode and encode normally unreadable or formatted data that the may be sent between the client and the server. A simple example would be converting a long XML request into a more readable format. Another example would be converting an unreadable Base 64 request into something that can be read and parameterized. There are several other formats that LoadRunner supported out of the box. The ones that are supported in Loadrunner 12.5 are: Base64, Binary XML, GWT, JsonXML, Prefix Postfix, Remedy to XML, URL Encoding, XML, and XSS.
The key to using DFE is being able to understand when to use it. Sometimes LoadRunner will detect one of the supported formats and will give you a warning in the Code Generation Notifications about it, but most of the time you’ll have to identify them yourself. I am confident that a number of you can probably use DFE on the application you’re scripting right now. This article will cover some of the more commonly seen formats that can be converted using the DFE feature. Future articles will cover additional formats and techniques to handle them.
Let’s start with a simple XML request. You’ll sometimes see a web_custom_request with a text/xml content type. In the body you’ll then see a stream of XML. You can typically read this and add parameters to it. But it can be cumbersome with complex and long requests. For example, you have a request that may look like this:
As you can see, the XML data is not very easy to read. It is very difficult to find or compare a value within that request. However, using DFE, you can have LoadRunner covert it to a much more readable format that looks like this:
When you enable the DFE engine, LoadRunner saves the body into a parameter called DFE_BODY. You can then change, parameterize, and correlate the request any way you want. The new request will look like this:
How to use DFE to reformat XML
You need to make some changes to the recording options. Open up Recording Options and go to the Data Format Extension, Chain Configuration option on the left hand navigation tree. You should see a screen like this:You’ll want to click Add Chain under the Chains section. Give it a name. In my example I’m using XML. Now you need to add an extension. Click Add DFE in the Chain: XML section. This will give you a list of possible DFEs you can use. Select Xml Extension from the list. Xml Extension should now be listed as a DFE. You should also change the Continue Processing to True. If LoadRunner comes across any errors, it will continue to process the script.
The next step is to turn on DFE. Move to the Code Generation option. Check Enable data format extension. You also have to add the DFE to what you want scanned, typically the Body and Header. Under Body, you have the Default assignment. Change the Chain to XML from the list of values.
Now do the same for Headers.
Other Simple Types of DFE
There are a few other common types of DFE you might want to consider using: URL Encoding and Base64.
Since URLs can only contain ASCII characters, often times URLs or HTTP requests will be encoded to meet this requirement. You’ll see % followed by hexadecimal digits, example- “Northway+%26+LoadRunner+Solves+100%25+of+your+problems+and+saves+you+%24”. When you see requests or bodies that look like this, try the URL Encoding DFE to make it more readable.
Base64 is another common encoding you’ll find. Often times base64 will look like a random mix of letters and numbers followed by one or two ==. So if you see something like “VHlwZSAob3IgcGFzdGUpIGhlcmUuLi4=”, you might want to try the Base64 DFE extension.
I’m looking for some good public websites that uses XML, URL, and Base64 so I can add some real world examples. If you know of any public sites that use these encodings, please post them in the comments so I can add some examples.