Apache JMeter

About

Download

Documentation

Tutorials (PDF format)

Community

Foundation


21. Hints and Tips

This section is a collection of various hints and tips that have been suggested by various questions on the JMeter User list. If you don't find what you are looking for here, please check the JMeter Wiki . Also, try search the JMeter User list; someone may well have already provided a solution.

21.1 Passing variables between threads

JMeter variables have thread scope. This is deliberate, so that threads can act indepently. However sometimes there is a need to pass variables between different threads, in the same or different Thread Groups.

One way to do this is to use a property instead. Properties are shared between all JMeter threads, so if one thread sets a property , another thread can read the updated value.

If there is a lot of information that needs to be passed between threads, then consider using a file. For example you could use the Save Responses to a file listener or perhaps a BeanShell PostProcessor in one thread, and read the file using the HTTP Sampler "file:" protocol, and extract the information using a PostProcessor or BeanShell element.

If you can derive the data before starting the test, then it may well be better to store it in a file, read it using CSV Dataset.


21.2 Enabling Debug logging

Most test elements include debug logging. If running a test plan from the GUI, select the test element and use the Help Menu to enable or disable logging. The Help Menu also has an option to display the GUI and test element class names. You can use these to determine the correct property setting to change the logging level.

It is sometimes very useful to see Log messages to debug dynamic scripting languages like BeanShell or groovy used in JMeter. Since 2.6, you can view log messages directly in JMeter GUI, to do so, use menu Options > Log Viewer, a log console will appear at the bottom of the interface. Note that log messages are cleared each time you disable this option. By default this log console is disabled, you can enable it by changing in jmeter.properties:

  • jmeter.loggerpanel.display=true


21.3 Searching

It is sometimes hard to find in a Test Plan tree and elements using a variable or containing a certain URL or parameter. A new feature is now available since 2.6, you can access it in Menu Search. It provides search with following options:

  • Case Sensitive : Makes search case sensitive
  • Regexp : Is text to search a regexp, if so Regexp will be searched in Tree of components, example "\btest\b" will match any component that contains test in searchable elements of the component


Figure 1 - Search raw text in TreeView


Figure 2 - Result in TreeView


Figure 3 - Search Regexp in TreeView (in this example we search whole word)


Figure 4 - Result in TreeView





Copyright © 1999-2012, Apache Software Foundation
Apache, Apache JMeter, JMeter, the Apache feather, and the Apache JMeter logo are trademarks of the Apache Software Foundation.