Skip to content

JMeter

Performance Testing GraphQL with JMeter

In this Blog Post we are going to look at the GraphQL HTTP Request sampler and look at how GraphQL requests can also be made using a HTTP Request sampler in case you are for some reason restricted to an earlier version of JMeter (the sampler was only introduced in JMeter 5.4).

We will also look at some of the principles of GraphQL.

If your application under test comprises of a GraphQL service, you are going to have to understand how to test it and some of the performance considerations that surround performance testing of GraphQL.

JMeter HTTP Request Sampler

There are many samplers that JMeter provides but I am willing to bet that the HTTP Request samplers is the most frequently used and, in this Blog Post, we are going to look at how this works and how it can be configured.

HTTP Request

Before we look at the sampler lets look at the option available to us in the HTTP Request drop down, while you probably don’t need to understand these in order to test you application using JMeter it can be useful.

These request methods indicate the action to be taken on the resource specified in the Web Server section of the sampler and are sometimes referred to as HTTP verbs, these are defined by The World Wide Web Consortium (W3C). W3C is the main international standards organisation for the World Wide Web.

There are 5 main methods used in modern API’s these are:

Method Description
GET The GET method requests a representation of the specified resource. Requests using GET should only retrieve data.
PATCH The PATCH method is used to apply partial modifications to a resource.
POST The POST method is used to submit an entity to the specified resource, often causing a change in state or side effects on the server.
PUT The PUT method replaces all current representations of the target resource with the request payload.
DELETE The DELETE method deletes the specified resource.

Performance Testing Web Sockets with JMeter

In this post we are going to look at WebSockets, specifically how JMeter can be used to test them.

Web Sockets are not supported natively by JMeter but there are a couple of Plugins that you can use that work very nicely.

One of them is called JMeter WebSocket Sampler by Maciej Zaleski and information on the library can be found here.

The second and the one we will use for our post is also called JMeter WebSocket Sampler and is by Peter Doornbosch, more information on this Plugin can be found here.

Push to production pipelines and JMeter

This post does not look at a particular aspect of JMeter nor does it give a detailed overview of how to use a particular tool that will compliment your performance testing with JMeter.

What it is about is the principles of push to production pipelines and performance testing and while I have stated that this post is not specifically about JMeter in my experience JMeter is one of the best performance testing tools for this type of pipeline integration.

What problem are we trying to solve

Let’s consider how the world of application and technology development is moving.

Everyone seems to be focussed on Agile delivery and shifting their testing to the left and if done correctly and if Agile principles are followed this can be very successful.

We've already discussed about shift left testing and the principles behind the execution of JMeter tests from a Jenkins pipeline on this blog.

Now this is all good and speeds up the testing and ultimately the time for the product to reach production but there is a move towards using CI/CD tools ensure that Application definitions, configurations, and environments should be declarative and version controlled.

In essence if the tools detect a change to any aspect of your application or infrastructure through version control then a pipeline is spawned to ensure that they are all in sync.

Dynatrace integration with JMeter

Dynatrace is a cloud monitoring platform and is used by many organisations to measure the performance of their production systems and to set thresholds against which performance tolerance are measured.

During testing Dynatrace can be used to monitor how the application under test responds during your performance tests as well as providing the capability to drill down into performance issues you may need to investigate.

This is not a blog post on Dynatrace and how it works as that would consume the whole post, this is a post on how you can get your performance tests writing to Dynatrace and some simple ways to monitor the output of these tests.

Once you can see the results of your tests in Dynatrace you can then investigate what use you can make of the data using the Dynatrace documentation.