Jason Corbett
Jason Corbett

Reputation: 109

How to use existing Java API tests inside Jmeter

We have existing Java tests that singularly tests our back end. These tests are pretty elaborate, and also run as a single users. I would like to know if I can simply take these existing tests/classes/libraries/jars etc and just wrap JMeter around them to execute them as JMeter tests from the command line (i.e. Maven).

Maybe add in some listeners and other JMeter components, but the tests are perfect the way they are except that they are not multi-threaded and do not have the reporting functions that JMeter has.

Can this be done using JSR233?

What if my libraries are located elsewhere? How can I use them in the JMeter project?

Upvotes: 1

Views: 452

Answers (1)

UBIK LOAD PACK
UBIK LOAD PACK

Reputation: 34526

You have at least 3 options:

  • Implement JavaSamplerClient by extending AbstractJavaSamplerClient, this class will call your class. Create a Jar from this and put it in jmeter/lib/ext + add dependencies to jmeter/lib folder and you can then use Java Request and select your class.

  • Use JSR223 Sampler + Groovy wrapper for your class

  • Use JUnit Sampler if you have some JUnit classes

Upvotes: 1

Related Questions