? QA Design Gurus: Jmeter
Showing posts with label Jmeter. Show all posts
Showing posts with label Jmeter. Show all posts

Oct 17, 2015

REST APIs Performance Testing using JMeter


JMeter allows us to test performance of both static and dynamic resources (web services like SOAP and REST APIs).
In this post, we will provide steps to test the performance of REST APIs

Installing and Running JMeter:

  • Download the JMeter apache-jmeter-2.13.zip from http://jmeter.apache.org/download_jmeter.cgi
  • Extract to any directory location (Ex: C:\). Note: Make sure that Java 6 or later version should be available)
  • Go to JMeter installation location -> bin directory and start 'jmeter.bat' file
  • Observe that JMeter user interface will launched successfully

Steps to write JMeter script for REST API test:


  • The first step is to create a Thread Group under Test Plan.
  • Thread Group is a placeholder for all other elements like Samplers, Controllers, and Listeners. We need one so we can configure number of users to simulate.
  • Right click on Test Plan -> Add -> Threads (Users) -> Thread Group. Name it.It has the options to provide 'Number of Users', 'Ramp-Up Time' and 'Loop Count'. Right now, provided 1 for all fields as shown in below image


  • Right click on Thread Group -> Add -> Sampler -> HTTP Request and provide server name, port number, path and add parameters. Save it. Note: Make sure that the server which you provided is up and running.


  • Add 'View Results Tree' to check the request status.Save it.

  • Click on Run icon to run the script.
  • Observe that script get executed successfully and you can see the results in View Results Tree window.

  • We are able to run one REST API method successfully for one time. As specified above, you could run this script many number of times/forever by specifying the 'Loop Count' in Thread Group.

Mar 24, 2015

Writing and running JMeter tests using Blazemeter

When I was asked to look at scalability testing, I came across an interesting tool, Blazemeter.
Usually, setting up the Load Testing infrastructure, writing automation around it, managing, maintaining and monitoring the load test infrastructure is a headache. We need to spend lot of time in setting up the infrastructure instead of focusing only on load testing.

Blazemeter is a Saas based high scalable load testing tool that can handle up to 3,00,000+ concurrent users. Their load test infrastructure is spread across major AWS regions. BlazeMeter enables us to write load test-scripts not only using JMeter but also using Selenium.

With BlazeMeter, all we need is to write the test-scripts, choose the amount of load-engines and run the test. The system takes care of the everything else. Unlimited number of load-engines are pre-configured and available at your disposal. Detailed graphical reports are generated during the load.

Recording:
The main feature I like in Blazemeter is that, it provides a Chrome Extension which can record browser actions and convert it to JMeter .jmx file. This script will be automatically uploaded to Blazemeter where we can run it using a single click.


Running tests:
For running the tests, we can configure the test time, duration and number of users. We can even schedule the test to run weekly in BlazeMeter. It is an added advantage. The load uses a pre-configured distributed load testing environment. The environment is ready to use and available at all times.
Blazemeter also provides REST APIS. Instead of manually starting the tests, we can make use of these APIs through which we can even run the tests by writing an automated script.

Monitoring:
Blazemeter provides live monitoring when the test is running which enables us to decide on the number and instance type for the test.
While performing load testing, it is important not only to monitor your Web Servers & Databases but also the agents from where the load is generated.

Results:
As soon as the test is completed, results will be sent to configured mail address. The reports will provide us with all the KPIs we need. Reports can be exported to csv or zip formats. We can easily share all the results with our team. Also, reports can be compared

Interesting plugins:
Integration with:

  • NewRelic: Used to monitor the application performance while load tests are being run.
  • Google Analytics: If we select the Google Analytics Option and provide account details of Google Analytics, BlazeMeter obtains the last 12 months of data and creates a test with 5 most visited pages and sets up the number of concurrent users based on that record.
  • JMeter, Teamcity: To include the load tests part of continuous integration.
  • WordPress
  • Drupal