Monday, September 14, 2009

My First Experience with JMeter

While in the process of collecting performance statistics with my own test programs I was introduced to JMeter by Michael Ottati. It’s a nice framework for declaratively composing sequences of tests and collecting statistics from runs of those tests. It has a graphical interface that allows you to compose test sequences, run the tests, and view the results in either tabular or graphical format.

As I began to learn more about JMeter by reading the overview documentation my main question became: “how do I integrate my custom tests with JMeter?” In Michael’s case he seemed to have a somewhat heavyweight integration in which his custom project was intimately intertwined with the JMeter distribution. I set out to see if a little lightweight integration was possible.

Here is a brief summary of what I ended up doing:
  1. Installed a vanilla JMeter distribution on my system.
  2. In my own project (in a separate directory tree) I created some custom “Samplers” which extended the AbstractJavaSamplerClient interface of JMeter.
  3. I created a file in the current working directory from which I would launch JMeter. In the file I added “search_paths” and “user.classpath” entries which referenced the classes and supporting jars of my custom project.
  4. I ran JMeter and created a Test Plan. In the Test Plan I added a “Java Request” sampler. In the configuration screen for “Java Request” sampler there is a pull-down list of available samplers. My new samplers showed up in the list (by virtue of the “search_paths” entry in
That’s all it took. The connection between my custom project and the JMeter distribution was simply the file in my own directory tree. I didn’t have to modify the JMeter distribution at all.


No comments:

Post a Comment