Skip to content

JMeter

Using JMeter Assertions

We are going to discuss JMeter Assertions in this post. There is already a fantastic Ultimate Guide post about how to use JMeter Assertions in the JMeter section of the OctoPerf Blog and this can be found here. Before starting on this post, it would be advisable to read the post on JMeter Assertions that already exists and linked above to get a firm understanding of how they work and the various types that exist.

This blog post is going to use the information in this post and consider how assertions can be used to help your performance testing especially when building complex tests and using them to make decisions as your tests run.

The aim of this post is not to reiterate the contents of the Ultimate Guide blog post but to take an example of one or two of the regular expressions and discuss how they can be used in the wider context of performance testing scenarios.

The reality is that any of the assertions can be used to manage your performance testing and it depends on the technology you are testing and therefore the assertions best suited to this.

JMeter language support

In this blog post we are going to discuss using JMeter localised to a language other than English.

We are not discussing computer languages that are supported.

We will look at currently supported languages and how to change your local instance to use these languages.

We will also look at how you can submit a language translation if you would like to and have the ability to.

JMeter ForEach Controller

Among the many elements JMeter offers for creating test scenarios, the ForEach loop stands out as an efficient way of browsing and processing data.

The ForEach loop in JMeter is a controller that allows you to cycle through the elements of a list or variable, executing the test samples included in the loop for each element iteratively. This is particularly useful when you need to perform tests with dynamic data, or when you want to repeat a sequence of samples for different values.

  • Save time and effort:
  • The ForEach loop simplifies the management of test scenarios involving dynamic data, reducing complexity and development time.

  • Improved maintainability:

  • By using the ForEach loop, test scenarios remain easily understandable and modifiable, facilitating long-term maintenance.

  • Dynamic test scenarios:

  • Allows tests to be adapted to real-life situations by iterating over variable data sets.

Uploading Images in JMeter

In this blog post we are going to look at simulating the process of uploading an image to a web-site in JMeter for load testing.

Image uploading is a relatively straightforward process to simulate in JMeter. There are a few different ways to approach this, which we will explore.

In order to follow along, you can download the sample JMX here.

Setup

Before we start to look at uploading images with JMeter, we are going to need a test site to use.

We will use an online image upload site for the purposes of this blog post as it makes the upload process easy to follow.

You may have an image upload site in your organization, or you may be reading this for understanding how to upload image to an application you are testing. In any case, the way JMeter handles uploading images is the same.

Run JMeter tests in Java code

In this blog post, we will run JMeter tests from code. First we will look at how we can create an IntelliJ project in Java to build a JMeter performance test.

Once you understand how JMeter tests in code can be written you can start to build tests in your development code base to compliment unit tests or functional tests written by developers during the creation of application and services.

In a DevOps world it is the responsibility of developers to support all development effort with a suitable and robust set of tests that are run as the code is built and deployed into the various non-prod and prod style environments and your performance tests can sit alongside these.

We have chosen to use IntelliJ due to its widespread use and we have chosen to create a Maven project to allow us to import the JMeter dependencies.

Clearly your preference may be different, but the principles remain the same.

We will build and execute this as a stand-alone project to demonstrate the principles but once you are happy with how it works there is no reason you cannot build similar performance tests in your application development codebase or even pair with the development teams to build a performance capability in your deployment pipelines.