How to use Reg-Ex in JMeter?
You can add Reg-Ex component under those request samplers whose response contain a dynamic value.
1. Right Click on request
2. Add->Post-Processors->Regular Expression Extractor
You can add Reg-Ex component under those request samplers whose response contain a dynamic value.
1. Right Click on request
2. Add->Post-Processors->Regular Expression Extractor
3. Provide Reference Name, Regular Expression Statement (along with unique left and right boundaries), template, Match No. and Default Value.
4. Choose where this Reg-Ex is applicable.
5. You need to specify "Field to check" where dynamic value can be found.
7. Default Value: If the regular expression does not match, then the default value will be set to a reference variable.
Tip: You can use debug sampler to check captured reg-ex value.
Related Topic:
4. Choose where this Reg-Ex is applicable.
- Main sample only: Search in the main sample only
- Sub-samples only: Search in the sub-samples only
- Main sample and sub-samples: Search in both sample and sub-samples
- JMeter Variable: Assertion is to be applied to the contents of the named variable
5. You need to specify "Field to check" where dynamic value can be found.
- Body: In the body of the response
- Body (unescaped): In the body of the response, with all HTML escape codes replaced. Note that this option highly impacts performances, so use it only when absolutely necessary and be aware of its impacts
- Body as a Document - the extracted text from various type of documents via Apache Tika. Note that this option highly impacts performances, so use it only when absolutely necessary and be aware of its impacts
- Request Headers: In request header
- Response Headers: In response header
- URL: In request URL
- Response Code: HTTP status code
- Response Message: In response body as a message
7. Default Value: If the regular expression does not match, then the default value will be set to a reference variable.
Tip: You can use debug sampler to check captured reg-ex value.
Related Topic:
No comments:
Post a Comment