Home » Java » Enterprise Java » How to perform client side web performance testing in JMeter?

About Shantonu Sarker

Shantonu Sarker

How to perform client side web performance testing in JMeter?

In this article we will see how can we do client side performance testing using Jmeter Plugins.

I will be using jmeter webdriver plugins. Before starting this topic, please have some basic information on client side performance testing from my previous post. So, lets get started:

 
 
 
 

Installation

  1. Install Jmeter and Plug ins from below links following this post.
    • Jmeter
    • Plugins (you may choose only web driver, but I prefer all of them)
  2. Download Selenium Server from here. (you need java to run that)
  3. Download Firefox 26 from Archive. Why 26? because jmeter webdriver plugins supports firefox 26. Here is link where you see supports the details.

    Note: This can be tricky if you have an updated Firefox version. In that case you can do like me.

    • Disable firefox update checking
    • Install in new folder in separate directory name.

      installation[5]

    • When you run this one for the first time, just cancel the initial update process. As you have disabled firefox update (in your updated firefox), make sure you see the update settings disabled in this firefox 26 too.

    Note: This part is little tricky, I have provided separate post to resolve it.

    For Jmeter Remote Execution or local, it is better to to have only one firefox (version 26) with no auto update settings which will minimize complexity for test execution.

  4. Keep firefox 26, selenium server in path variable. To check, type firefox from command line and run. You should see, firefox 26 launched in desktop.

    image[18]

    image[9]

    image[19]

  5. Setting Jmeter: Usually, we do not need any extra things for webdriver sampler. But, as we need debugging, we might use this following property in user.properties file.

    webDriverJmeter[5]

    It enables sub sampling which is good for debugging.

    webdriver.sampleresult_class=true

    Let me explain how it works: JMeter webdriver sampler is just an extension of http sampler, not alternative, with a script editor. When it runs, it actually calls firefox driven by webdriver. That means, it sends its instruction to mainly webdriver and, webdriver does every thing. Now, you might be wondering how code goes to the web driver. Like as other code support, webdriver core runs as external code following JSR specification. It is actually JavaScript execution. And, you see, it is just like as webdriver java code with some basic modification due to jmeter adoption. I will provide separate blog or coding.

    And after you write the steps as webdriver script, use listeners to get time. Like as other samplers, you use listeners to debug sensibly.

Browser supporting

Just follow this link which mentions the configurable browser names that are supported by webdriver sampler. You can see this from jmeter too:

image[4]

Time Measurement

Webdriver sampler calculates time from this line of code:

WDS.sampleResult.sampleStart()

to this line of code:

WDS.sampleResult.sampleEnd()

So, for debugging, we need sub samples which will be shown as child of main sample. For this purpose, we need to activate
sampleresult_class (set to true). After activation we can do sub sampling like

WDS.sampleResult.sampleStart()
//Brows to a URL
//Add user name and password
WDS.sampleResult.subSampleStart('Log In request')
//Click Log in
WDS.sampleResult.subSampleEnd(true)
//Check title
//do some another process
WDS.sampleResult.sampleEnd()

In view result tree listener, you can see the main sample that contains the sub sample name “’Log In request’”. And a main sample can have multiple sub sample. That means, we can calculate each time separately from result tree.

Note that sub samples will not be shown separately in tabular format listeners or graphs.

And, if we need to measure particular transaction, we can split single test among multiple webdriver samples. For example, a sampler for log in, a sampler for doing some work in home page, a sampler for messaging, etc.. In this way, we can see results in reports. Usually each business transaction is measured in separate sample where as detail steps are sub sampled.

Writing the first script:

To write a webdriver sampler script, you need to add the webdriver sampler (sampler –>webdriver sampler) with any browser (driver) configuration. See image from the browser support section to get the driver configuration elements.

I will provide a separate post on how to write a webdriver test script with an example. You can see some nice guidelines at the wedriver sampler wiki.

Test Planning:

As we know from my previous post on client side performance test, this test should run from a single user or thread. As the jmeter sampler populates the browser with webdriver, this has a particular hardware requirement. That is, it will occupy a single thread of a processor. That means, if you want to run the webdriver sampler, you need at least 2 core CPU. Why 2 core? The other one is for Jmeter. So, if you have 8 core CPUs, you can run only 7 threads for webdriver samplers. So, for testing we have to add a separate thread group or a test block for webdriver sampler.

We will run for measuring client execution time on:

  1. When there is not much user load
  2. When average load on server
  3. When High load(considered as peak load)

Sometimes, it is also good to test the following too:

  1. Beyond capacity, where error can be occurred or may just after error condition.
  2. As continuous performance testing. Usually, people run selected regression test with jmeter daily or weekly.

Again, the formula is simple, 1 thread of CPU for single client performance testing.

And, you run the test simply as Jmeter test, that’s all.

(0 rating, 0 votes)
You need to be a registered member to rate this.
2 Comments Views Tweet it!
Do you want to know how to develop your skillset to become a Java Rockstar?
Subscribe to our newsletter to start Rocking right now!
To get you started we give you our best selling eBooks for FREE!
1. JPA Mini Book
2. JVM Troubleshooting Guide
3. JUnit Tutorial for Unit Testing
4. Java Annotations Tutorial
5. Java Interview Questions
6. Spring Interview Questions
7. Android UI Design
and many more ....
I agree to the Terms and Privacy Policy
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Dmitri T
Dmitri T
6 years ago

Thanks for the great tutorial guide. In my turn I would recommend checking out The WebDriver Sampler: Your Top 10 Questions Answered guide as WebDriver Sampler plugin uses JavaScript language and implementing “usual” selenium activities in it might be tricky.

cheney
cheney
1 year ago

REminds me of needing to use a combination of winrunner and loadrunner to test Citrix or GUI web applications back in the day–and all the fiddling we needed to go through… that was back when we could install things on our own machine and change registry configs… wonder how many tickets would be neeeded to get this set up by the help desk..