Dummy Sampler
A guide to using the Dummy Sampler plugin in Apache JMeter for creating custom requests and responses as test stubs.
Mark
Performance Testing Expert
The Dummy Sampler is a valuable JMeter plugin that provides a localised method of sending a custom request and returning a custom response. It functions effectively as a stub within test plans.
Installation Process
- Download the
plugins-manager.jarfile - Place it in the
lib/extdirectory - Restart JMeter
- Navigate to Options > Plugins Manager
- Select Available Plugins
- Search for “dummy sampler”
- Apply changes
Key Features
The jp@gc - Dummy Sampler offers configurable options including:
- Response codes
- Response messages
- Connect time
- Latency
- Response time
- Request/response data
- URLs
Practical Example
You can use the Random function to generate varied response codes between 1-5 with a suffix pattern:
${__Random(1,5)}00
Additional configurations include:
- Random latency:
${__Random(1,100)} - Response time variations:
${__Random(10,1000)} - Response data with random numbers:
${__Random(1,1000)}
Use Cases
The tool proves particularly valuable for testing incomplete applications, such as when APIs remain under development. Developers can substitute dummy samplers for unfinished endpoints while returning valid responses, allowing testing to proceed without waiting for backend services to be complete.
This approach enables:
- Testing UI flows before APIs are ready
- Simulating various response scenarios
- Validating error handling with custom response codes
- Creating predictable test conditions
Further Reading
Tags: