When designing your JMeter test locally, it is useful to have target endpoints to test against. Depending on your test logic, this may even be a requirement. However, a suitable environment for making these requests is not always available. To avoid generating an unknown number of uncontrolled requests against real endpoints, there the JMeter Dummy Sampler. In this brief post, we will show you how to add the Dummy Sampler to your load test and describe a few scenarios where it can be useful.
This plugin is particularly useful when designing complex thread logic. Adding one or more Dummy Samplers to your test will provide reportable results without unnecessarily generating real requests. To add a Dummy Sampler to any test simply select it from the Samplers menu when adding it as a component to an existing Thread Group:
Once added, you have several options that you can configure to help simulate real requests. You can define a response code and message (e.g.,
200) as well as set latencies that would be expected for actual network requests. Most of these parameters are also able to be scripted, and in the following example JMeter shorthand function calls are used to generate random latencies:
Use cases for the Dummy Sampler include any instance where you need to act on a response. This includes debugging your test plan with complex test logic or scripts that are dependent on such responses. For instance, you can set the response code of the Dummy Sampler to return a random status code (such as an occasional
500 server error) to simulate real-world responses. You can even simulate saturation points for a stress test or soak test by associating a scripted variable for latency using the
Did you known that RedLine13 offers a full-featured free trial? Sign up now and start testing today!