Loading...

How I (also) use JMeter for Integration Tests

Continuous Integration
September 26, 2019
2 minutes to read
Share this post:

In my current project I focus on the development of a highly available, scalable system that can handle millions of players worldwide. In order to test and ensure that this is actually the case we need to do regular performance and integration tests. While - for a long time - I explicitly separated both, I choose a new direction in this project by writing the JMeter performance test in a way that it can be used as an integration test as well.

This approach has two major benefits. First, you only have to maintain one test in order to fulfill both quality aspects and second you - more likely - end up with a fully fleshed integration and performance test.

But it also means, that your performance test must be executable and in best case executable in parallel on your buildmachine. I do the following:

As you can see I use docker to execute the test and the backend. This way I can ensure the correct order and work in my own network which enables the test to be run in parallel.

The jmeter client is inspired by the docker-jmeter-client and uses wait-for to detect when the backend is ready to process requests.

As a result from the jmeter client you get a file which you can analyze with Jenkins Performance Plugin . My test plan is executed with a single thread by default and the performance plugin checks if no error occurred. Otherwise the build fails.

The big benefit is that I can simply increase the number of threads in JMeter now to turn the same testplan into a performance test.

Have you heard of Marcus' Backend Newsletter?

New ideas. Twice a week!
Top