Dockerized JMeter + Taurus StarterKit — DS

Devstringx Technologies
4 min readApr 11, 2024

--

Docker is an open-source platform designed to streamline and optimize the software development lifecycle. Docker enables developers to focus on processes and methodologies instead of wasting time handling products and their prerequisites.

Kubernetes is a powerful tool for building effortlessly manageable and deployable applications across diverse environments.

Prerequisites

  • Initially Install Docker Desktop on your local machine.
  • Install Kubernetes in your local machine, so that you deploy your workloads in parallel.
  • Install Minikube in your local machine, which instantiates a VM on your local machine and sets up a basic cluster comprising just a single node.

Once all the prerequisites are installed on your local. Let’s start with the setup of configuration files needed for the Jmeter+Taurus setup.

I created A Github Template Repository that anybody can use to easily start a new project. I have added all the configs. files that are needed while doing the setup.

How to use this starter kit?

Step-1: Clone Repository on Your Local

  • Simply clone the starter kit repository on your local machine.
  • Create one Jmeter scenario that you want to execute inside the slave pods and save it with the name k8s-load-test.jmx.

The File tree of the repo. is the following:

  • Jmeter_Starter_Kit
  • config. Files
  • K8s-load-test.JMX

Step 2: Build a Docker Image

  • First, Make sure that your docker daemon is in a running state.
  • You can use a built-in docker image that contains Jmeter + Taurus configuration or also use customized docker image which is in the starter kit.
  • If You are using a customized docker image from Docker-Hub, make sure you change the name of the docker image in both the master and slave deployment files.
  • If You are using a customized docker image, make sure you first build that docker file and change the name of that docker image in both configuration files.
  • To build your docker image :
  • Go to the specific location of the docker file.
  • Make sure the minikube in your local area is in a running state, You can start minikube using the below command.
  • minikube start
  • Before building the docker image, switch to the new docker-env using minikube by the below command.
  • eval $(minikube docker-env)
  • Build your docker file using the below command :
  • eval $(minikube docker-env)
  • Build your docker file using the below command :
  • docker build -t your-image-name:tag-name.
  • After your docker file builds successfully, You can check the same by using one docker command.
  • docker images
  • Update the name of your docker image in the deployment files.

Step 3: Launch the test

  • Again, at the repository write: If you’re using Windows: Open Bash.
  • ./finalexecution-script.sh -c 1 -j k8s-load-test.JMX
  • The Script Usage is:

How does the Script work?

  • First, It will Delete the Master and slave jobs and create it again.
  • After creating the slave pods, it will extract the slave pods ’ IPs using the update_slaves_ips shell script and update it in the distributed section of the taurus_execution.yaml file.
  • In the taurus_execution.yaml file, We have an execution section in which we are setting the concurrency, iterations, and ramp-up for your JMeter script.
  • Also, setting up the pass-fail criteria for the JMX file.
  • After updating the IPs, it will copy all the files that are present in your repo. slave pods using Pod_Name.
  • Then, it will check your pod’s status i.e., is running or not.
  • If your pod is running, then it will automatically start the execution using the taurus_execution.yaml.
  • After the completion of execution, you can check the results also.

How to check the Results?

  • First, you need a pod name to get inside the pods. Use this command
  • kubectl get pods
  • Execution reports are stored inside the master pods. So, you have to get inside the master pods to view the reports.
  • Using this command, You will be able to get inside the master pods :
  • kubectl exec -it master-pod-name — bash
  • Once you get inside the master pod, Using the “ls” command you can see your execution reports in the form of a “.jtl” file.

So, That’s How You can execute your Jmeter Scripts inside Kubernetes pods using Taurus.

Related Post

JMeter Load Testing: A Comprehensive Guide

Using JMeter for API Testing: A Practical Tutorial

Originally published at https://www.devstringx.com on April 11, 2024

--

--

Devstringx Technologies

Devstringx Technologies is highly recommended IT company for custom software development, mobile app development and automation testing services