Testing Tool

Automated performance testing with jMeter

Published at May 25th 18, 05:30

Background

Today the key feature of any website is how fast it performs and how fast we can get the results out of it as today nobody has time to wait and stare the screen to get the desired output.

To fix that we need Performance Testing and to do performance testing we need scripts, to get the scripts we need time and a performance engineer which is a time-consuming process.

In performance testing, the most important thing is to identify the scenarios for performance, the scripts and then to identify and analyze the results.

The most time taking and painful part in whole is the scripting so what if I say we made that easy!!

Just one click and your scripts are ready to run on any platform you need, be it LoadRunner, JMeter, Neoload etc.


The Problem

Today almost every tool has a capability of recording the steps you perform on the AUT and then generating a script out of it, but the major challenge is to correlate that. 

So for a nonperformance guy, the question will be “What does this correlation mean?”

Explaining that in a very layman terms is capturing the dynamic values returned by the server and then sending that with every request so that you can fool your server that the request is valid and you should get a valid response.

Now, this might seem to be a very small and an easy job but let me tell you it wasn't.

We need to dive deep into every response, rerun the scripts to find out the difference, looking into those dynamic ids and then keep correlating them with the help of regular expressions which takes a hell lot of time and efforts.


The Solution

We initially started with a thought “what if this can be automated?” as there are many who are working on automated reporting automated load models etc but no tool has this capability to automate the core, The Scripting!!

Then the biggest question was Maybe this is not achievable because if it is then there are tech giants who would have done this, no?

But apart all we thought of giving it a try and see we get something else it will be a lesson learned.

We researched a lot and then found out a way to proceed on:

  • Get the HAR files of each action performed from chrome.
  • Repeat the steps performed and get another HAR to compare.
  • Compare the HAR’s and get the dynamic values and boundaries.
  • Correlate them by identifying the left and right boundaries.
  • Put that correlation in place of the tags.
  • Finally, generate a script in the desired format as per the tool and get the script ready.


Getting the HAR File

To get the HAR we also made a recorder which can record the steps we perform and then re-run those which helped us remove one more human intervention. 

The first challenge we faced was to generate the HAR and we tried Phantom JS and puppeteer but later learned that it does not have the right capabilities to create multiple HAR then we researched a bit more and finally settled on selenium with JAVA. One problem solved!!


Comparing the HAR Files

The next was to compare 2 HAR’s and get the differences, easy we did that in a while by storing each element as a key-value pair and later comparing them to get the results.


Backtracking

Now the most complicated process was to correlate them by identifying the left and right boundaries on the fly and get the values correlated. We struggled a lot in that and finally figured out that every application responds differently so we cannot automate everything at a go.

We figured out some very basic and the most common values returned which should be taken care first and we started covering them. 


<(anything) key = value (anything)/> 
<(anything) key (anything) value (anything)>
<(anything) value (anything) key (anything)>

To get the values in Header, cookies, and Body 

Finding the dynamic boundaries was really tough but after a lot of iterations and struggle we did that finally

Now the next challenge was to put those pieces together and create a script out of that. For this, we targeted JMeter script first and created a valid JMX out of that which can be easily run in Jmeter.

We put all the pieces together and created a tool which can just record the actions you doing on browser as a plugin and send the HAR generated to our server where our engine works and create 2 runs of the project to compare, the engine compares then and auto-generates a JMX file out of this which we can run at our servers and we will get beautiful reports out of that.


Conclusion

We are still enhancing our tool each and every day by adding more and more conditions in that and making the system more intelligent.

We research and try to challenge our skills and sometimes we achieve which seems impossible.

Not believing in the story? Ask a demo for the product to see it live!!