Posted

3 minutes read
Here is how to use Apache JMeter’s WebDriver Sampler to load test the UI of the application, and by the UI, I mean load test a user’s workflow, with entering the web pages, clicking on different links etc.
All you have to do is install the JMeter plugins and make use of the WebDriver Config and WebDriver Sampler plugins which will offer this capability.
Let’s go into more detail and see how to load test an app with Apache JMeter’s WebDriver Sampler.
Here are the steps to Load Test the UI:

  • Add a Chrome Driver Config

      • choose if you want to create a new Browser at the start of each iteration (if you don’t tick this option, the browser instances are going to be reused per each thread, which will cache some of the assets, requests)

  • Add a WebDriver Sampler

      • add the following code which will monitor the load time for loading the following webpage https://www.example.com?uid=${token}


WDS.sampleResult.sampleStart()
WDS.browser.get('https://www.example.com?uid=${token}')
WDS.sampleResult.sampleEnd()
      • the token variable is previously generate by an HTTP POST request
      • imagine the scenario where you first have to authenticate in order to access a webpage, this is what we do
          • generate a token with an HTTP POST request
          • extract the token from the HTTP POST response

        • open the webpage with the token as a query parameter and monitor the load time
    • add an Aggregate Report in order to measure the load testing metrics like number of samples, response times, errors, throughput

    • add the Listeners from the JMeter Plugins: Response Times Over Time, Hits per Second and Active Threads Over Time to better understand the behaviour of your application while running the load test of the UI

Run the test at the beginning with only 1 thread in parallel, to create the baseline. The you can increase the number of threads (parallel users) to find performance bottlenecks. Here are more details on performance testing vs load testing.

Hope this helps.




Thanks for reading. I hope you learned something interesting about React!
If you found this article useful, please share it with others. Don’t forget to subscribe to get notified for the upcoming articles.