How to do correlation in JMeter

Correlation in JMeter / Regular Expression Extractor

Allows user to extract values from the server response using a Perl-type regular expression. As a post-processor, this element will execute after each Sample request in its scope, applying the regular expression, extracting the requested values, generate the template string and store the result into the given variable name.


1.1     How to write a regular expression


Step 1:

Run the particular test and try to identify the dynamic value in the in the View Results Tree.

Note:
Need to run for multiple times and compare the results manually. Some external tool can be used to compare the response.

Step 2:

Identify the LB, RB of the dynamic value

Step 3:

Write the regular expression for the dynamic value using the LB and RB. Check the particular regular expression using View Results Tree.

Step 4:

Find the occurrence (match number) for the required dynamic value

Step 5:

Add the regular expression extractor for the previous request.


Note: In the above figure, the regular expression mentioned was an example. 

Some Regular Expressions Parameters:

Characters
Description
()
It captures null value between LB and RB
(.+?)
It captures the correlated value between LB and RB. This function is used for ord=1 case or ord=all case
(.\d)
It captures the correlated value as digit format between LB and RB
(.*)
It captures the correlated value as character between LB and RB


Attributes in Regular Expression Extractor:

Attribute
Description
Name
Descriptive name for this element that is shown in the tree.
Apply to
Main sample only - only applies to the main sample
Sub-samples only - only applies to the sub-samples
Main sample and sub-samples - applies to both.
JMeter Variable - assertion is to be applied to the contents of the named variable
Response Field to check
Body - Used to check only in the body of the response
Body (unescaped) - Used to check the body of the response, with all Html escapes codes replaced.
Headers - may not be present for non-HTTP samples
URL - Used to check in the URLs
Response Code - Used to check based on the response code
Response Message - Used to check based on the response message
Reference Name
Name of the parameter variable
Regular Expression
Need to substitute the regular expression created
Template
The template used to create a string from the matches found
Match No.
Indicates which match to use
Default Value
If the regular expression does not match, then the reference variable will be set to the default value.


6 comments:

  1. I would definitely thank the admin of this blog for sharing this information with us. Waiting for more updates from this blog admin.
    gst training in chennai
    Angularjs Training in Chennai
    CCNA Training in Chennai
    salesforce training institute in chennai
    ui design course in chennai

    ReplyDelete
  2. you have written an excellent blog.. keep sharing your knowledge...
    JMeter Training in Chennai
    JMeter Certification

    ReplyDelete