NeoLoad – Correlation (Handling Dynamic Value)
The next stage is handling the dynamic value that is ‘Correlation’ in the NeoLoad script once you have recorded the navigation flow of the AUT (application under test) and verified the user path. As I detailed in the section on the correlation between Load Runner and JMeter, the correlation process involves three steps:
- Recognizing Dynamic Value
- Correlation Logic implementation
- Take the correlation variable in place of the dynamic values.
For NeoLoad, these three stages also apply. So let’s piece together the correlation in NeoLoad step by step.
Recognizing Dynamic Value
The first step is to determine the right value coming from the server, which changes depending on the user, the request, and the time. NeoLoad offers the ability to automatically identify dynamic values based on a specific pre-defined rule (Framework Parameter) or generic rule. You can scan the recorded script using the automatic correlation option to find and correlate the dynamic variables (see the page on script recording for more information). If you feel comfortable performing the manual correlation, you can also choose to neglect this option.
NeoLoad may not be able to recognize every dynamic value in some complex situations; as a result, manual correlation is required.
‘Check User Path’ is the simplest approach to begin the dynamic value identification procedure. Run “Check User Path” and compare the script to “New User” before continuing. If it fails, there may be a correlation with that specific request. Let’s look at a perfect example:
Figure:01
In the preceding illustration, favicon.ico failed user path validation and generated an HTTP 404 error, which denotes a client-side issue. Consequently, this is where your inquiry starts. Anyway, this is only an illustration.
Let’s say that we have determined that the value “BIRDS” is a dynamic value that requires correlating. Now go to the section where you implement the correlation logic.
Correlation Logic implementation
Implementing the correlation logic comes next after identifying the dynamic value. Once you have determined the correct dynamic value, proceed as described below. Please take note that in this instance we must correlate “BIRDS”
1. Go to the dynamically important stage. The third request is passing the value of the ‘categoryId’ argument, which is ‘BIRDS’.
Figure:02
2.’Flag in the answers can be chosen by performing a right-click on the dynamic value.
Figure:03
3. The request(s) and transaction(s) that contain the dynamic value in the response will be highlighted by NeoLoad. A checkmark is visible over the Action, Transactions, and Requests icons.
Figure:04
4. Select the first transaction that has a checkmark by clicking.
Figure:05
5. Select the transaction’s very first request. The answer to this request contains the necessary dynamic value.
6. Next, select the “Advanced” button that is located at the bottom of the window.
Figure:06
7. The phrase “Advanced” pops up.
Figure:07
8. Select the “Recorded response” tab.
Figure:08
9. To find the dynamic value, press ‘Ctrl + F’. At the bottom, a search bar with the options “Find,” “Next,” “Previous,” “Match case,” and “Highlight” may be seen.
Figure:09
10.NeoLoad will locate and highlight the value in the blue backdrop as you type the text or dynamic value. By clicking the ‘next’ button, you can look for more instances of the value. Use the ‘Match case’ and ‘Highlight’ options as needed.
Figure:10
11. You can use the dynamic value and the left and right border text to build the search logic. To make it simple to identify dynamic values, the chosen string must be unique. ViewCategoty=&categoryId=BIRDS is the selected string in the screenshot below. Here, ” (double quote) will be treated as a Right Boundary and ” (viewCategory=&categoryId=) as a Left Boundary.
12. Copy the string you’ve chosen.
Figure:11
13. Select the ‘Variable extractors’ tab.
14. A plus sign (‘+’) is present at the bottom.
Figure:12
15. The ‘Definition’ tab and the Variable Extractor pop-up appear.
Figure:13
16. Now enter the following data in the appropriate fields:
- Variable name: the name of the correlation variable that the script will use. The dynamic value that appears in the script’s following requests will be swapped out by this variable.
- Identify the value in: It specifies the search parameters where dynamic value is to be found. Here are the search criteria:
- Body
- Header
- Both
- Variable
- Expression: Enable this option and enter the corresponding value if you want a response in JSON or XML format.
- Look in the response body for the sentence:
- Starting with: ‘Left Bounday’ copied content should be pasted in step 11.
- Followed by: Define the dynamic value’s format, including its number, text, alphanumeric, etc. This field aids in determining the appropriate dynamic value.
- finishing with: ‘Right Boundary’ content should be copied and pasted in step 11.
- To extract the occurrence: It identifies the location or occurrence of the value. Since 5 is shown in the screenshot, the necessary value is pressed. graft at position 5, as shown. How do I find the place number of the dynamic value at this point? So, to answer this, you should also take into account the value that is displayed in the “Value extracted from included content” field. If the displayed value and the dynamic value match, that’s OK; if not, increase the value by one and check the text. The initial setting is 1. In this case, entering 5 in the form will display BIRDS in the “Value extracted from included content” field.
Therefore, 5 is the correct place number corresponding to the required dynamic value.
There are even more options, including:- Extract each instance – To collect all values that meet the search criteria.
- A randomly selected instance: to select a random value from a list of identified values
- Value is represented by: This option is advantageous for encoded values. Depending on your needs, choose the appropriate option from the dropdown list.
- The value derived from the included material: According to the information entered in the ‘Occurrence to extract’ field, the search result will show the searched text.
Figure:14
17. ‘OK’ should be clicked.
18. You will see that a new row has been added to the ‘Variable Extractors’ tab next to the regular expression.
Figure:15
The correlation variable should be used instead of the dynamic values.
Once the dynamic value identification and mapping logic implementation processes are complete, all dynamic value instances must be replaced with the mapping variable in the test script. While doing the following:
1. Click the “Find and Replace” button after selecting the appropriate variable row.
Figure:16
2. There is a ‘Find and Replace’ popup.
3. Select “Replace All” or “Replace Manually” from the menu. Let’s choose ‘Manual replacement’ to help you understand what values are being replaced in the script.
Figure:17
4. NeoLoad offers ‘Previous’, ‘Current’, ‘Next’, ‘Replace’ and ‘Replace All’ options in the ‘Find/Replace’ popup and presents prompts with dynamic values one by one. Replace the dynamic values with your own choices using the available options.
5. Select “Replace” on the toolbar.
Figure:18
6. This is how the value will appear after the defined correlation variable replaces it. Please refer to the image below.
Figure:19
Conclusion
handling dynamic values via mapping in the NeoLoad script is a critical step to ensure accurate load test results. However, it is essential to emphasize the importance of originality and avoid plagiarism in this process. By following the steps outlined above and acting ethically, you can effectively handle dynamic values while maintaining originality. Here are some important points to remember:
- Identify dynamic values – Identify the dynamic values in your Application Under Test (AUT) that require correlation. These can be session IDs, CSRF tokens, timestamps, or unique identifiers.
- Catch and Extract – Use NeoLoad’s mapping capabilities to capture and extract dynamic values from server responses. Develop your own mapping logic specific to your AUT and avoid directly copying mapping logic or code from external sources.
- Replace with parameters: Replace the extracted dynamic values with parameters or variables in subsequent requests within the NeoLoad script. This ensures that the script accurately represents realistic user behavior.
- Stay original: create your own parameterization logic without copying directly from external sources. Trust their knowledge and experience to implement the specific mapping logic for your load-testing scenario.