Search code examples
javajmeterbeanshellcustom-functionjmeter-3.2

Jmeter: How to reuse custom java function between different JMX file


Requirement: Post response time of every sampler to Mongo DB, for that created an HttpClient java code(Class function).

Problem: Need to call the custom (reuse same code between 150+ jmx file) Java function to be called from Beanshell after every sampler.

void logTransaction(responseTime,samplerName);

Solution need: Incorporate custom java function(.c or .txt) with jmx file.

For example in Load runner we can include .h file(shared in common path) with reusable code and include in globals.h.

Is there any method or solution available with jmeter ?


Solution

  • enter image description here

    Code can be reusable by saving in a java file and give the file path in JSR223.