Site icon Vinsguru

Extending JMeter – Creating Custom Functions – String Joiner

JMeter is one of the best open source tools in the Test Automation Community. It comes with all the possible extensions to come up with our test scripts quickly. To make our life even more easier, It also lets us to come up with our own plugins by implementing few interfaces.

In this article, Lets see how we can create a custom function and make it appear in the below JMeter’s Function Helper dialog.

 

Goal:

My goal is to create a simple Join function which will join 2 given strings with a given delimiter & store it in an user defined variable.

The usage would be  ${__join(string1, string2, delimiter, resultVariable)}

Reference:

We will refer to the JMeter’s AbstractFunction which should be extended for creating our own function &  __strLen function to get an idea how our own function can be implemented.

 

Setting Up IDE:

Lets first set up our IDE with all the dependencies.

 

Creating Custom Function:

The StrJoin class would look like this.

 

Export:

 

Testing Custom Function:

 

Summary:

I hope this article would help you to come up with your own function implementation. We will also see more how we can extend other JMeter’s test elements in our future articles.

 

Happy Testing & Subscribe 🙂

 

 

Share This:

Exit mobile version