Configure the JMeter Java Request samplers: properties, defaults, and practical usage notes for building reliable load tests.
Part of the Samplers category. Also documented in context in the full Component Reference.

This sampler lets you control a java class that implements the
org.apache.jmeter.protocol.java.sampler.JavaSamplerClient interface.
By writing your own implementation of this interface,
you can use JMeter to harness multiple threads, input parameter control, and
data collection.
The pull-down menu provides the list of all such implementations found by
JMeter in its classpath. The parameters can then be specified in the
table below - as defined by your implementation. Two simple examples (JavaTest and SleepTest) are provided.
The JavaTest example sampler can be useful for checking test plans, because it allows one to set
values in almost all the fields. These can then be used by Assertions, etc.
The fields allow variables to be used, so the values of these can readily be seen.
| Name | Required | Description |
|---|---|---|
| Name | No | Descriptive name for this sampler that is shown in the tree. |
| Classname | Yes | The specific implementation of the JavaSamplerClient interface to be sampled. |
| Send Parameters with Request | No | A list of arguments that will be passed to the sampled class. All arguments are sent as Strings. See below for specific settings. |
The following parameters apply to the SleepTest and JavaTest implementations:
| Name | Required | Description |
|---|---|---|
| Sleep_time | Yes | How long to sleep for (ms) |
| Sleep_mask | Yes | How much “randomness” to add: The sleep time is calculated as follows: totalSleepTime = SleepTime + (System.currentTimeMillis() % SleepMask) |
The following parameters apply additionally to the JavaTest implementation:
| Name | Required | Description |
|---|---|---|
| Label | No | The label to use. If provided, overrides Name |
| ResponseCode | No | If provided, sets the SampleResult ResponseCode. |
| ResponseMessage | No | If provided, sets the SampleResult ResponseMessage. |
| Status | No | If provided, sets the SampleResult Status. If this equals “OK” (ignoring case) then the status is set to success, otherwise the sample is marked as failed. |
| SamplerData | No | If provided, sets the SampleResult SamplerData. |
| ResultData | No | If provided, sets the SampleResult ResultData. |