Jump to content

Custom plugin creation and integration with JMeter and Azure Load Testing


Recommended Posts

Guest Shivam_Maralay
Posted

JMeter has a lot to offer, though sometimes, you may run into use cases that are unique to your workflows or user scenarios, and not directly implementable using standard JMeter elements. For example, you might want to enable a custom authentication process, create a sampler of your own, or design a testing element that is not yet released in the open source JMeter community.

 

Custom plugins extend the core functionality of JMeter and may allow you to implement that custom scenario into your performance tests to fine tune your test scripts and reporting capabilities. Learn how to get more from your performance testing, using custom plugins and Azure Load Testing.

 

 

 

In our blog we will talk about how one can broadly classify planning and execution for performance testing in 3 stages.

 

  1. Pre-Requisite (Mandatory) – Test Data, environment setup check, property file, 3rd party connectivity, firewall rules etc.
  2. Execution - Run your test scripts with Azure Load Testing
  3. Post execution (Optional) – Report Generation, Basic Validation etc.

 

Take advantage of Azure Load Testing’s support for custom plugins to optimize your test planning (pre-requisites) and reporting, allow user to use the plugins from https://jmeter-plugins.org or, upload a Java archive (JAR) file with your own plugin code.

 

 

 

Consider a case for Custom Plugin – “If there is a need of 1Million of JSON files to be created and inserted in database as pre-requisite before execution, once execution is completed, we need to validate if the records are transformed correctly and pushed to some other database”

This can be handled easily using a custom plugin – “Which will have a Java function which can create a Million JSON file and do a DB (databases) insert and once execution is done via JMeter script in Azure load test, can provide a quick validation and generate report as well.”

 

 

 

Custom Plugin(jar) is created using Java SDK (software development kits). Classes and Function can be called JMeter BeanShell Sampler or JSR223 Sampler. These are the steps for generating simple custom plugins, integrating them with JMeter Suite.

 

Pre-Requisite -

1. Java SDK (latest version recommended)

2. Maven (latest version recommended)

3. IDE (integrated development environments) (Visual Studio Code or any other IDEs)

 

 

Steps for Creating Custom Plugin

 

1. Download the Sample Java Maven project -

azureloadtest_custompluginsample.zip

 

mediumvv2px400.png.3c935d00eed38476db1295c31a14919c.png

 

 

2. Using Maven create a JAR using the command

mvn clean compile assembly:single

Note: Execute this command on the location having .pom file present.

 

 

3. Link the new JAR in the JMeter Suite - Click on browse and import jar.

Note Use the name of the JAR file instead of using the complete path of the JAR file

 

for example. in our case we have name as sampleexample-1.0-jar-with-dependencies.jar

 

 

 

mediumvv2px400.png.6400192f6e18e436b8fb896253f7cf86.png

 

 

 

4. Create a BeanShell or JSR223 Sampler in your JMeter Suite and import the package after this create an object of class and call the functions.

 

mediumvv2px400.png.b1013deff488872d75f428c3821319ae.png

 

5. Upload the .jmx file and .jar file in Azure Load Testing and perform the execution

 

Read more about JMeter plugins in the Azure Load Testing docs: https://learn.microsoft.com/azure/load-testing/how-to-use-jmeter-plugins?tabs=portal

 

 

 

Additional resources:

 

 

If you have any feedback on Azure Load Testing, let us know in our feedback forum.

 

Continue reading...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...