Load Testing GWT-RPC applications with UbikLoadPack Plugin for JMeter

on 30 December 2012 AJAX, DEVOPS, GWT, JMETER, JSON, LOAD_TESTING, MEDIABEACON, STIBO and Tags: , , , , , , , , with 3 comments
GWT-LoadTesting

Load Testing GWT-RPC applications with UbikLoadPack Plugin for JMeter

Context

You have a GWT-RPC (Google Web Toolkit RPC) based application and you want to load test it using Apache JMeter

But the problem you are facing is that GWT-RPC protocol uses an optimized format which makes it  hard if not impossible to:

  • Understand the content of requests and responses
  • Extract data and variabilize it to make the test realistic

Let’s be clear enough, testing without doing those 2 things would be similar to making all users search for the same product or edit the same content, in a word if you are going to do it without it don’t do it !

Here is an example of GWT Request:

7|0|5|http://www.geniuswiki.com/gwtpage/|0624EB2D417666E544D36FBFBA6E1831|

com.edgenius.wiki.gwt.client.server.PortalController|getDashboard

|Z|1|2|3|4|1|5|0|

And a response:

//OK[14,16499,13,12,0,9,9,0,0,0,0,9,9,11,10,0,0,0,0,9,9,8,6,7,6,1,5,4,3,2,2,0,1,

["com.edgenius.wiki.gwt.client.model.RenderMarkupModel

/3648883652","java.util.ArrayList/4159755760","com.edgenius.wiki.gwt.client.model.MacroModel

/453643445","portal","java.util.HashMap/1797211028","java.lang.String

/2004016611","showlogo","true","","com.edgenius.wiki.gwt.client.model.TextModel

/1981019746","<br />","demo gwt","java.lang.Integer/3438268394","demogwt"],0,7]

So you’re stuck and wonder how to do this.

Hopefully, You’re in the right place, we have the answer to your request 🙂

In this tutorial, we will show you how to:

  • record a GWT RPC scenario using [www.geniuswiki.com Genius Wiki] site
  • Extract some data and variabilize it
  • Use it in you requests

Plugin Setup

Follow this guide:

UBIK LOAD PACK GWT PLUGIN

Or watch this video:

Recording

To record the scenario, we will use the Standard JMeter HTTP(S) Test Script Recorder.

UBIK GWT Plugin seamlessly integrates with Standard JMeter and works behind the scene to translate GWT-RPC requests to readable XML format.

Recording setup

If you don’t want to read what’s below, you can also watch this video:

We will create a very simple Test Plan to record the scenario. For this we setup:

  • HTTP Request Defaults (Server Name or IP : www.geniuswiki.com)
  • HTTP Header Manager

Image:ULP_GWT_TUT01_HM.png

  • HTTP Cookie Manager with default configuration
  • User Defined Variables that contains some data that we want JMeter to automatically change to variables:
    • X-GWT-Permutation : This is the permutation’s strong name. This id is guessed by looking http://www.geniuswiki.com/gwtpage/<ID>.cache.html file included in the main page or by one of the subsequent requests which URL ends with <HEX>.cache.html.
    • X-GWT-Module-Base
    • wordToSearch : test (we will search for this text during recording)
    • login : The login we will use on the website
    • password : The password we will use on the website

Image:ULP_GWT_TUT01_UDV.png

And we add an HTTP Test Script Recorder which we configure this way, note it is standard JMeter configuration:

Image:ULP_GWT_TUT01.png

Finally, we configure Firefox to point to the JMeter Server proxy:

Image:ULP_GWT_TUT02.png

Recorded Scenario

Scenario has 5 steps:

  1. Display Home Page : www.wikigenius.com
  2. Click on Login button, popup is opened, Enter login, password and click on Login button
  3. Enter test in upper right input text and enter, search results are displayed
  4. Click on one search result
  5. Click on Logout

Image:ULP_GWT_Scenario.png

Recording result

This is what JMeter has recorded, we will zoom on Sample which is the click on Search for test:

Image:ULP_GWT_TUT03.png

Let’s see what our plugin displays in View Result Tree element:

A new View ULP_GWT-to-XML appears at the bottom right of View Result Tree element with a GWT Tab:

Request Tab displays:

  • The original raw Request in GWT-RPC encoded format
  • The XML created by our plugin to ease variabilisation and readability

Image:ULP_GWT_TUT04.png

Response Tab displays:

  • The XML created from the GWT-RPC response by our plugin to ease variabilisation and readability

Image:ULP_GWT_TUT05.png

Another View ULP_GWT+XPath Tester  appears at the bottom right of View Result Tree element. It lets us test XPath expression to extract <contributor> content, you can see:

  • The XML translated GWT-RPC response in the top panel
  • The XPath expression in the middle
  • The extraction result in the bottom panel

Image:ULP_GWT_TUT06.png

Finally let’s see what our plugin has recored for one sample: Image:ULP_GWT_TUT07.png

As you can see, instead a GWT-RPC format, plugin has set the XML translated request and by the way test has been replaced by ${wordToSearch}.

Extract and variabilize

To show how extraction and variabilization works, we will:

  1. Extract from search response (Sample 340 /search.rpcs) one of the contributor ids
  2. Inject it in the Sample 344 /page.rpcs which is the request that handles the click on search results

To extract the contributor element content from the GWT-RPC response:

  1. we add an ULP_GWT PostProcessor which will store in result variable the GWT-RPC response translated to XML, it will also check response is from expected type com.edgenius.wiki.gwt.client.model.SearchResultModelImage:ULP_GWT_TUT08.png
  2. we add a standard XPath Extractor which will use the result variable, apply the XPath expression //results/com.edgenius.wiki.gwt.client.model.SearchResultItemModel/contributor to extract the id of the link to click and store the result in resultToClick variable. Note you could also use a Regular Expression Extractor to do that. Image:ULP_GWT_TUT09.png
  3. we can now use ${resultToClick} in the next GWT-RPC request

Image:ULP_GWT_TUT10.png

The final touch

Running this plan will fail because XML requests will be sent instead of GWT-RPC formats.

To fix this, we add ULP_GWT-PreProcessor, this element will do the MAGIC which translates XML format to GWT-RPC one.

Image:ULP_GWT_TUT11.png

You’re done

Thanks to ULP GWT Plugin, in less than 10 minutes, we have variabilized a test plan using our knowledge of Standard JMeter and 4 additional Test elements:

  • ULP_GWT PostProcessor to transform GWT-RPC response to XML and store it as a variable
  • ULP_GWT-PreProcessor to transform XML translated GWT-RPC requests to GWT-RPC format
  • ULP_GWT-to-XML view integrated in View Results Tree element to view and debug Test Plan
  • ULP_GWT+XPath Tester view integrated in View Results Tree element to view and test XPath expressions on XML translated responses.

As you can see, our plugin is fully compatible with Standard JMeter elements so that you can reuse all the power of JMeter.

Plugin is compatible with versions Apache JMeter starting from 3.0 up to current 5.3.

About the author:

Philippe M. works as an Architect and technical expert for Ubik-Ingenierie where he leads among other things the development of UbikLoadPack a set of Commercial Plugins for Apache JMeter allowing to load test different protocols like HLS, MPEG-DASH, Smooth Streaming, GWT or Java Serialization.
Philippe is a committer on the Apache JMeter project and member of the PMC since October 2011.
Finally he is a co-author of a book on JMeter called Master JMeter: From Load Testing to Devops.

About UbikLoadPack:

3 Comments

Comments are closed.