Close

July 8, 2013

How to correlate JSON based web application using Data Format Extension?

In this tutorial we will see how to correlate JSON based web applications in HP LoadRunner using Data Format Extension. You can check it out my earlier posts on how to correlate in HP LoadRunner Part 1 and Part 2.

JSON, Base64, GWT, URL Encoding, XML based applications returns binary and unformatted data which is very tough to correlate using default manual/automatic correlation. Here comes Data Format Extension, new feature of HP LoadRunner 11.50.

[stextbox id=”info”]What is Data Format Extension?[/stextbox]

Modern applications return unformatted and binary data which is difficult to correlate. Data Format Extension converts the code to much readable format which allows you to parameterize and correlate easily.

It works like ordered chains. Each chain consists of extensions. If HTTP message has one header, body and one query string user can select default chain, if HTTP message has multiple headers and cookies section, user can assign different chains. Hence, VuGen uses name field to match it correctly.

Following are the Data Format Lists:

Data Format Extension Description
Base64 Extension Decodes strings that are encoded with as BASE64 encoder.
GWT Extension Transforms GWT data to XLM format.
URL Encoding Extension Decodes strings that are encoded with URL encoding format.
JSON Extension Transforms JSON data to XML format.
XML Validator Extension Receives data and checks to see if it conforms with XML syntax. This check allows VuGen to perform correlations based on XPath and to display snapshot data in an xml viewer.
Prefix Postfix Extension Enables you to cut data from the beginning and/or end of a string which you do not want decoded. You can add and customize as many prefix/postfix extensions as required. Each postfix/prefix extension created should have a unique display name and tag name.

[stextbox id=”info”]How to use Data Format Extensions?[/stextbox]

Before recording you need to enable Data Format Extension by navigating to Record > Recording Options or press CTRL + F7.

[auto_thumb width=”150″ height=”150″ link=”” lightbox=”true” align=”center” title=”How to correlate JSON based web application – QAInsights – Recording Options” alt=”How to correlate JSON based web application – QAInsights – Recording Options” iframe=”false” frame=”true” crop=”true”]http://qainsights.com/wp-content/uploads/2013/07/How-to-correlate-JSON-based-web-application-QAInsights-Recording-Options.jpg[/auto_thumb]

Click on Code Generation under Data Format Extension and then check on Enable data format extension. Next, select Code and snapshots under Configuration as shown below.

[auto_thumb width=”150″ height=”150″ link=”” lightbox=”true” align=”center” title=”How to correlate JSON based web application – QAInsights – Recording Options DFE – 2″ alt=”How to correlate JSON based web application – QAInsights – Recording Options DFE – 2″ iframe=”false” frame=”true” crop=”true”]http://qainsights.com/wp-content/uploads/2013/07/How-to-correlate-JSON-based-web-application-QAInsights-Recording-Options-DFE-2.jpg[/auto_thumb]

Now click on Chain Configuration and then click on * button as shown below.

[auto_thumb width=”150″ height=”150″ link=”” lightbox=”true” align=”center” title=”How to correlate JSON based web application – QAInsights – Chain Options DFE – 3″ alt=”How to correlate JSON based web application – QAInsights – Chain Options DFE – 3″ iframe=”false” frame=”true” crop=”true”]http://qainsights.com/wp-content/uploads/2013/07/How-to-correlate-JSON-based-web-application-QAInsights-Chain-Options-DFE-3.jpg[/auto_thumb]

Enter valid chain name as shown below and then click on OK.

[auto_thumb width=”150″ height=”150″ link=”” lightbox=”true” align=”center” title=”How to correlate JSON based web application – QAInsights – New Chain DFE – 4″ alt=”How to correlate JSON based web application – QAInsights – New Chain DFE – 4″ iframe=”false” frame=”true” crop=”true”]http://qainsights.com/wp-content/uploads/2013/07/How-to-correlate-JSON-based-web-application-QAInsights-New-Chain-DFE-4.jpg[/auto_thumb]

Next step is to add DFE, by clicking on + button as shown below.

[auto_thumb width=”150″ height=”150″ link=”” lightbox=”true” align=”center” title=”How to correlate JSON based web application – QAInsights – Add DFE – 5″ alt=”How to correlate JSON based web application – QAInsights – Add DFE – 5″ iframe=”false” frame=”true” crop=”true”]http://qainsights.com/wp-content/uploads/2013/07/How-to-correlate-JSON-based-web-application-QAInsights-Add-DFE-5.jpg[/auto_thumb]

Select JSON to XML Extension as shown below and then click on OK.

[auto_thumb width=”150″ height=”150″ link=”” lightbox=”true” align=”center” title=”How to correlate JSON based web application – QAInsights – List of available DFEs – 6″ alt=”How to correlate JSON based web application – QAInsights – List of available DFEs – 6″ iframe=”false” frame=”true” crop=”true”]http://qainsights.com/wp-content/uploads/2013/07/How-to-correlate-JSON-based-web-application-QAInsights-List-of-available-DFEs-6.jpg[/auto_thumb]

Now select True in Continue Processing as shown below.

[auto_thumb width=”150″ height=”150″ link=”” lightbox=”true” align=”center” title=”How to correlate JSON based web application – QAInsights – From JSON to XML DFE – 7″ alt=”How to correlate JSON based web application – QAInsights – From JSON to XML DFE – 7″ iframe=”false” frame=”true” crop=”true”]http://qainsights.com/wp-content/uploads/2013/07/How-to-correlate-JSON-based-web-application-QAInsights-From-JSON-to-XML-DFE-7.jpg[/auto_thumb]

Now click on Code Generation under Data Format Extension to add Chain Assignment. Click on Headers and then click on + button as shown below.

[auto_thumb width=”150″ height=”150″ link=”” lightbox=”true” align=”center” title=”How to correlate JSON based web application – QAInsights – Chain Assignment – 8″ alt=”How to correlate JSON based web application – QAInsights – Chain Assignment – 8″ iframe=”false” frame=”true” crop=”true”]http://qainsights.com/wp-content/uploads/2013/07/How-to-correlate-JSON-based-web-application-QAInsights-Chain-Assignment-8.jpg[/auto_thumb]

Select the chain that you have added before as shown below.

[auto_thumb width=”150″ height=”150″ link=”” lightbox=”true” align=”center” title=”How to correlate JSON based web application – QAInsights – Selecting Chain – 9″ alt=”How to correlate JSON based web application – QAInsights – Selecting Chain – 9″ iframe=”false” frame=”true” crop=”true”]http://qainsights.com/wp-content/uploads/2013/07/How-to-correlate-JSON-based-web-application-QAInsights-Selecting-Chain-9.jpg[/auto_thumb]

Similarly add for Cookies section as well. I didn’t any find any application in the internet to explain the Data Format Extension concept. You can watch below video for more details.

Thanks for visiting QAInsights! Check out our new portal Testifications.com to get updates on Software Testing related certifications. We’re always posting interesting articles on QAInsights. I request you to subscribe so you don’t miss out anything. Searching for QA Jobs Openings, check it at www.QAJobOpenings.com

Want to start a blog like this, please visit SpidyDomain to buy cheap web hosting and register domain.

Subscribe to our QAInsights YouTube Channel | Subscribe our free weekly newsletter.

About NaveenKumar Namachivayam

Hi there! is a passionate and experienced Performance Test Analyst based in Chicago, USA with skill sets in Manual Testing, Test Automation, Performance Testing, and Test Estimation. He loves to learn and experiment new trends and models in Software Testing. Please stop by at his personal blogs: Excel Blog, DealsBrook, NaveenKumarN.in, and Affiliate Insights blog and Software Testing Memes.

One Comment on “How to correlate JSON based web application using Data Format Extension?

ganeshjoe
November 12, 2014 at 9:26 am

Hi Naveen,
Could you please let us know how to work with deflate and base64 encode format captured in LoadRunner Body Request?? there are standard algorithms to decode base63 in LR , but how to deflate/inflate the encoded /decoded data? Pls share your views on this

Reply

Leave a Reply

Your email address will not be published. Required fields are marked *