Processors in JMeter

Processors in JMeter

What is a Processor in JMeter?

In JMeter, a processor is an important element that enables the manipulation or modification of data within a Test Plan before or after the execution of a request. This capability allows the customization of data sent to a server and the extraction of specific information from server responses, to further use in our test.

Types of Processor in JMeter:

Pre Processor:

Pre-processors in JMeter are elements designed to perform actions or modifications before the execution of a sample request. They provide the flexibility to set up data, variables, or conditions, allowing you to customize and prepare your script based on specific requirements.

For Example: you can use a pre-processor to setup an authentication token, generate data for requests etc. to use in subsequent requests.

Commonly Used Pre-Processors:

  • User Parameter: Allows you to define user-specific parameters.

  • BeanShell Pre-processor: Allows you to execute the custom script before sending a request.

  • JSR223 PreProcessor: It's similar to BeanShell pre-processor but supports multiple languages.

How to Add a Pre-Processor:

  • Right-click on the thread group.

  • Hover over "Add."

  • Select "Pre-Processor".

  • Choose the required pre-processor based on your requirements.

Post Processor:

Post-processors in JMeter are elements that allow you to extract information from the server response after a sampler has been executed. They play a crucial role in extracting specific data from the server response for further use in your test.

For Example: With the help of a post-processor you can extract values like session ID from a response and use it in subsequent requests, to extract value from a response you can use a regular expression extractor.

Commonly Used Post-Processors:

  • Regular expression extractor: Allows you to extract data from a server response using regular expression.

  • Boundary extractor: Helps in extracting data between specified boundaries.

  • JSON Extractor: Extract data from JSON response.

How to Add a Post-Processor:

  • Right-click on the thread group.

  • Hover over "Add."

  • Select “Post-Processor”.

Choose the required post-processor based on your requirements.

Conclusion:

Processors in JMeter serve as essential tools for manipulating data before and after the execution of a request. Pre-processors enable the customization of requests, while post-processors extract valuable information from server responses. Together, they enhance the flexibility and accuracy of tests, allowing for the simulation of real-world scenarios.

Did you find this article valuable?

Support Perf Insights by becoming a sponsor. Any amount is appreciated!