Handling Parent request sampler failure due to redirect failures in Jmeter

Consider a situation in which your parent request is redirecting to lot of other requests and in that one of the redirected request fails. On analyzing using the developer tools you find out that that particular redirect is failing even manually. But the problem with Jmeter is that it will mark the Parent request as failed when one of the redirect fails and this has to be handled by validating only the response of the parent request, as this is not an issue with the script.

Most people will handle this by adding the response assertion and just enable the "Ignore status". But this approach is wrong, as this will make the parent sampler request "Pass" even if the parent sampler request itself fails.

The correct approach to handle this is, to validate the response code of the parent sampler request and ignore the status of the failed redirect request.

Add a Response Assertion to the request which is failing due to redirects and set the below options

Apply to         --> Main sample only

Field to Test         --> Response Code

Field to Test         --> Enable "Ignore Status"

Pattern Matching Rules --> Equals

Patterns to Test         --> Click Add & Enter '200'



1 comment: