jmeter icon indicating copy to clipboard operation
jmeter copied to clipboard

Add fail option for regex extractor

Open jgaalen opened this issue 1 year ago • 3 comments

Description

This change adds the option to automatically fail a sampler if a regular expression extraction can't find any matches.

Motivation and Context

This saves the need to add an assertion with a regex to be sure there are matches. This will either save doing the regex matching twice and/or improved the scripts by failing if the extraction fails rather fail later when there is no value

Based on this discussion. Thanks to @asfimport for initiating this and providing code

How Has This Been Tested?

I've tested this on HTTP Requests only with different types of matches (1: single extraction, 0: random and -1 to match multiple fields)

Screenshots (if appropriate):

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • [ ] My code follows the code style of this project.
  • [ ] I have updated the documentation accordingly.

jgaalen avatar Mar 22 '24 16:03 jgaalen

Have you considered adding test case for the feature?

Not really, I'm not really into this. I've tried to make something out of an earlier existing (working) code for this feature as you've asked me to create a PR and would love this feature in JMeter, but I'm not a java developer. Can you help me out?

jgaalen avatar Mar 25 '24 20:03 jgaalen