What is Correlation
A Correlation is a Connection or Association.Capturing thedynamic data that is being generated by the server is called correlation.Why Correlation
It is the process to handle dynamic values in performance testing. If you simply record and playback a script in Jmeter, you might encounter errors in your playback. Often, those errors are related to the session values which are sent by the server to the client to identify that particular session.Why error?
Well, session values will change with every playback of the script.
To overcome this we need a way which can capture these dynamically generated session values and pass it subsequently to any part of the script, wherever required. This method to identify and set the dynamic generated value is known as correlation.
Using Regular Expression Extractor in Jmeter Tests
Regular expressions are used to search and manipulate text, based on patterns. JMeter interprets forms of regular expressions or patterns being used throughout a JMeter test plan. With the use of regular expressions, we can certainly save a lot of time and achieve greater flexibility as we create or enhance a Test Plan.You can place regular expressions in any component in a Test Plan. The next step will demonstrate the use of Regular expressions in the Regular Expression Extractor—a Post-Processor Element. This element will extract text from the current page using a Regular Expression to identify the text pattern that a desired element conforms with.
Add Regular expression Extractor
|
Regular Expression Extractor
|
Reference Name: The name of the variable in which the extracted test will be stored (refname).
Regular Expression: The pattern against which the text to be extracted will be matched. The text groups that will extract are enclosed by the characters '(' and ')'. We use '.+?' to indicate a single instance of the text enclosed by the <td>..</td> tags.
Template: Each group of text extracted will be placed as a member of the variable VOL, following the order of each group of pattern enclosed by '(' and ')'. Each group is stored as refname_g#, where refname is the string you entered as the reference name, and # is the group number. $1$ to refers to group 1, $2$ to refers to group 2, etc. $0$ refers to whatever the entire expression matches. In this example, the ID we extract will be maintained in VOL_g1, while the Name value will be stored in VOL_g2.
Match No.: Since we plan to extract only the second occurrence of this pattern, matching the second volunteer, we use value 2. Value 0 would make a random matching, while a negative value needs to be used with the ForEach Controller.
Default: If the item is not found, this will be the default value. This is an optional field. You may leave it blank.
After extracting the ID of the record that we want to edit, we are ready to select, edit, and update this record.