JMeter – Boundary Extractor
After going into detail about dynamic data management in the last post, let’s move on to the next post-processor component called “Boundry Extractor“. The purpose of the Bounds Extractor in JMeter is the same as the Regular Expression Extractor, which is to extract the dynamic value from the response, but it is implemented differently. In the Regular Expression Extractor, we use the regular expression (statement) to retrieve the dynamic value, but in the Boundary Extractor we only need to specify the left and right bounds of the dynamic value to be captured instead of a linear regular expression declaration with a complex token. .
When we examined the LoadRunner mapping functions for the Regular Expression Extractor and Boundary Extractor, we found that the Regular Expression Extractor behaves like web_reg_save_param_regexp() while the Boundary Extractor element behaves like LoadRunner’s standard mapping function web_reg_save_param(). For more information on how and why dynamic values should be matched, see the latest post.
How to add a ‘Boundary Extractor’?
Follow the below steps:
- Select the ‘Sampler’ element whose response contains the dynamic value and you want to capture it.
- Right-click on the element
- Hover the mouse on ‘Add’
- Hover the mouse on ‘Post Processors’
- Click ‘Boundary Extractor’
What are the ‘Boundary Extractor”s input fields?
The input fields for “Boundary Extractor” are as follows:
Name: To indicate the name of the post-processor
Feedback – To provide random feedback, if any.
Use to: Define dynamic value lookup parameters.
• Subsamples and the main sample: Use this search scope when the request is redirected so that dynamic material can be searched in both the main response and the response to the redirected request.
• parent instance only – Use this search scope when the request is not redirected or when the dynamic value only appears in the response of the parent request.
• Subexamples Only – You can use this search scope when a request is redirected and a dynamic value is provided in the response to the redirected request.
• JMeter variable convenient name: select this option and enter the name of the JMeter variable in the text field if the dynamic value should be taken from the value of any JMeter variable.
Field to check: Depending on the choice you made in the “Apply to” section, the search scope is narrowed and JMeter is told to search for dynamic values in a specific area of a JMeter sample, subsample, or variable.
• Body – Selecting this option tells JMeter to search the body of the response. The response header excludes from the search scope.
• Body (Unescaped) – All escaped HTML characters, such as &, ", and <, are included in the search. It is recommended to choose this option only when absolutely necessary, as search scope affects JMeter performance.
• Body as a document: This option allows JMeter to query the dynamic value in the document returned by the server.
• Response Headers – Only the response header part is searched and this captures the dynamic value. Non-HTTP request is not covered by this option.
• Request Headers – Selecting this option tells JMeter to look at the request header section. When the request is redirected and the dynamic value is passed in the subrequest header, it is beneficial. Non-HTTP requests are not covered by this option. When you choose this option, only URLs are included in the search scope. When the request is redirected and a dynamic value is present in the URL part, this option is used. The OAuth access token capture is the best illustration of this.
• Response Code: The response code is logged with this option. Consider a scenario where you have two transaction streams and you need to choose one based on the success (Response Code = 200) or failure (Response Code! = 200) status of the previous request. In this case, you can select “Response Code” as an option, which will return the response code.
• Reply Message: This option is used to retrieve the reply message. The response can contain words like OK, Gateway Timeout, etc.
Newly Generated Variable Name: The name of the variable that will contain dynamic data. Another name for this is a RegEx variable.
Left Limit: The left limit of the dynamic value. Regular expressions cannot be used with the left bound attribute value as it is case-sensitive. This quality is necessary.
Right Limit: The right limit of the dynamic value. Regular expressions cannot be used with the right-bound attribute value as it is case-sensitive. This quality is necessary.
Match number (zero for random): JMeter recognizes all matching values in the page, but stores only the fifth value in the regex variable if there is more than one string match in the response data and you need to capture a dynamic value that appears in a specific location (say fourth place). It is identical to the LoadRunner ordinal. While ‘0’ selects a random value from the list of dynamic match values, ‘-1’ is used to capture all values.
Default Value – The regex variable is set to the default value (such as Not_Found) if the regular expression does not match. This is especially beneficial for debugging.
Use an empty default value: If this box is checked, JMeter will set the empty string to the regex variable, which is not recommended because you can’t tell if the regex works correctly or not.