A Post-Processor elements is executed after the sampler and can be used for post condition response. If a Pre-Processor is added to a test plan, then it will be executed after response has arrived. A Post-Processor is often used to find out something from response for some actions. These action may be some time to validate response or to extract something and process.
Here is a list of available Post-Processors in JMeter:
- Regular Expression Extractor
- XPath Extractor
- Result Status Action Handler
- JSR223 PostProcessor
- JDBC PostProcessor
- BSF PostProcessor
- CSS/JQuery Extractor
- BeanShell PostProcessor
- Debug PostProcessor
JMeter Post-Processors "Result Status Action Handler":
Result Status Action Handler - This test element allows the user to stop the thread or whole test if the relevant sampler failed.
Action to be taken after a Sampler error : - Determines what happens if a sampler error occurs, either because the sample itself failed or an assertion failed.
The possible choices are Continue, Start next thread loop, Stop Thread, Stop Test and Stop Test Now
Continue - ignore the error and continue with the test
Start next thread loop - does not execute samplers following the sampler in error for the current iteration and restarts the loop on next iteration
Stop Thread - current thread exits
Stop Test - the entire test is stopped at the end of any current samples.
Stop Test Now - the entire test is stopped abruptly. Any current samplers are interrupted if possible.
Result Status Action Handler Example:
Step 1: Right Click Test Plan>Add>Threads(Users) > Thread Group
Leave all field as it is.
Step 2: Thread Group > Add > Post Processor > Result Status Action Handler
Select Action to be taken after a Sampler error as Stop Test Now
Step 3: Thread Group > Add > Config Element > HTTP Request Default
Set Server Name as: google.com
Step 4: Thread Group> Add > Sampler > HTTP Request (Change name to Google Home Page)
Step 5: Thread Group>Add > Sampler > HTTP Request (Change name to Google About Page)
Set Path as: /abt
Step 6: Thread Group>Add > Sampler > HTTP Request (Change name to Google Services Page)
Set Path as: /services
Step 7: Thread Group > Add > Listener > View Results in Table
Step 8: Save and Run the Test Case
If we observe above Results in Table, which shows us that 'Home Page' got success response, But 'About Page' test failed. As we have set in our Result Status Action Handler to 'Stop Test Now, that when the sampler got error so no further testing can be proceed. Hence the other sampler 'Services Page' not executed.
Add new comment