Correlation And Logical Actions of Neoload Tool (Part 3):
This is the 3rd part of Neoload training tutorial series.
In this tutorial, we will learn more about correlation, its types and few logical actions that are available in Neoload along with simple and easy examples for your better understanding.
What You Will Learn:
Correlation is completely different from the parameterization. Parameterization is performed for user input data. Correlation is performed for server generated values like session ID, application ID, Product ID etc.
Some requests are depending on the previously received response from the server such as session ID, server-generated date/time.
These values are different every time when you run the application or a recorded script. These values should be handled to run the script for multiple iterations for which we should capture the required values from the server response and pass it to the next requests wherever it is necessary. This mechanism in performance testing is called correlation.
It is very easy in Neoload, there is no need to write any functions or code to capture the dynamic values.
Before discussing in detail about correlation in Neoload, you should know about ‘Flag request’.
Flags are used to search, but flag identifies the requests which satisfy the criteria. It can easily identify parameters, correlated Variables, text checks, and SLA applied requests etc.
For Example, the script prepared by your colleague, if you want to know where he applied correlation, parameterization, text checks and SLA’s, then that can be easily identified using ‘Flag request’.
Note: Neoload script is not like LoadRunner, it is not easy to identify at a glance in which request parameterization, correlation, text checks are implemented. But these actions can be done easily with the help of Flags in Neoload.
Step #1: Click on flag request from the menu and flag request wizard will open.
Step #2: Select the option which you are looking for.
For Example, if you want to know which request correlations happen, then select the option ‘with variable extractors defined’ it will generate the tick mark the request in which the correlation (variable extractors used to handle correlation in Neoload) happen as shown in the below figure, in the same way, can search for text checks (called validations in Neoload).
Step #3: We can also see the value of the flag by just selecting the value and right click and choose ‘flag the value in request/response’ option then it will show in which request/response that value was generated.
Find the details in the below screenshot. The flag can also be available on the toolbar as shown in the below image.
It will highlight the request with a tick mark in which the server response value appeared. If value appeared in more than one server response, then it will highlight all the requests where the value appeared as shown below.
Flag request is very useful in Neoload and you can find more details of Flag Request.
Correlation values can be identified by using the Vuser check comparison in Neoload which was discussed in Recording Methods For Web And Mobile Application tutorial under the Debugging section.
Types of Correlation
There are two types of correlation methods that are available in Neoload:
- Automatic Correlation
- Manual Correlation (Recommended)
#1) Automatic Correlation
In Neoload, the automatic correlation is very simple to perform. But it is always good to follow the best practices by doing the manual correlation.
Step #1: Select the dynamic (server generated) value to correlate.
Step #2: Double-click on the value and then a parameter wizard will open as shown below.
Step #3: Select the option ‘use an extracted value’ and click on ‘Automatic configuration’ and it will automatically generate the regular expression to extract the values as shown below.
Step #4: Once the values extracted, it can be replaced easily by clicking on ‘Replace in requests’ or can manually replace.
Note: “Add to Framework” works like the correlation rules creation in LoadRunner. We can create a correlation rule once and use it many times in the subsequent script.
Step #1: Once you click on ‘add to framework’ it will open the framework wizard, then select the name of the framework and click next.
Step #2: Select appropriate settings depending on the requirement, whether it is required replacing the whole values or part of the value and can also change regular expression etc. and then click next.
Step #3: Search for dynamic values in the script (User Path) and click next.
Step #4: It will show the list of framework rules, click finish to replace the value with the variable.
Note: Under both Manual correlation and Automatic correlation the variables can be moved to Framework rules.
#2) Manual Correlation
Dynamic values can be correlated by capturing ‘left (In Neoload starting with) and right (ending with) boundaries.
In Neoload manual correlation has two modes:
- Simple Mode: Can handle simple correlation using left boundary and right boundary.
- Advanced Mode: Used to handle complex correlations using regular expressions like multiple lines of the response value.
Step #1: Select the dynamic (Server generated) value and right click on it and ‘Flag the response’ as discussed in the previous ‘Flag request’ section.
It shows the ‘tick mark’ for all requests where ever it appeared.
Step #2: Select the first request where the dynamic value appeared.
In the below screenshot the flagged value ‘FISH’, appeared in 3 requests, so select the first request where the ‘Fish’ appeared i.e ‘Enter Store’ transaction.
Step #3: Go to the request ‘Enter Store’ and click on the page where the flagged value appeared and click on ‘Advanced’ as shown below.
Step #4: Advanced parameter wizard will open, then select the ‘recorded response’ from the menu and search for Dynamic value appeared in the response or use ctr+f, it will highlight the value.
Step #5: Once you confirm the value that appeared in the response then select ‘variable extractors’ from the menu and click on ‘+’ to create correlation parameters.
Step #6: Once you click on the ‘+’, variable extractor wizard will open. Give the variable a name starting with(LB) and ending with(RB) and select the extractions single or multiple or random depending on the requirement.
Can test under the test option whether the given boundaries are working correctly or not. If LB or RB didn’t match, it shows not found instead of value.
Step #7: Once you enter all the fields click on ok. Then it will show the variable, select that variable and click on ‘search and replace.
As a discussed in the previous section, we can also move the parameter as ‘framework’ parameter to use in the further scripts.
Finally, Values are replaced with the variable as shown below.
Step #8: If the correlation is not able to perform with simple mode then go to ‘Advanced’ mode and give the regular expression to handle the correlation as shown below.
Neoload has some Logical actions to be used in the script and some of those are explained below in detail.
Logical actions can be used by drag and drop from the actions section.
Logical actions will be explained using the sample application.
This action pauses the User for a specified duration. The delay accepts values in milliseconds and may be set as a NeoLoad variable (useful for random delays).
Example: If you would like to take a delay between the user enter store and select the category. Just drag and drop the delay between those two transactions as shown in the below screenshot.
The value can also be a variable.
Loop is used to repeat distinct items such as pages/transactions, the number of iterations being defined by the user, etc. You can give either number or variable to iterate.
Example: Loop can be used for scenarios like if a user enters a pet store and he wants to select the items from each category then the loop will be useful.
As soon as a loop is dragged from actions the loop counter variable will be created automatically. You can use either generated loop counter variable or user-defined depending on the requirement.
While can be used to iterate the pages if the conditions are met. If condition satisfies, then the remaining pages/transactions can continue execution.
Example: If adding an item to the cart has some constraint like the item price should not be more than 500. So, to fulfill these types of requirements while can be useful.
#4) If Then Else:
if then else can be used for more than one condition. If conditions are met then it will execute, if the condition fails else will execute.
#5) Try Catch:
Try and catch can be used to perform trial and error actions.
Try can be executed until the error or assertion (text check) fail happened.
Catch can execute when the try failed.
Example: Scenario execution should go to the next iteration on HTTP error or scenario execution going to the next iteration if an assertion failed during the product selection.
Should check if the checkboxes are going to catch the errors only or both errors and assertions as shown in the above screenshot.
The transaction can be used to measure the response time per particular user actions. If we forget to add the transaction, while recording later we can add by dragging the transaction from actions.
#7) Go to next Iteration:
As shown in the try catch, the go to next iteration is used to skip the remaining transactions or pages from the current iteration and go to the next iteration.
It interrupts the VU runtime and goes to the next iteration. Behavior depends on where the action is placed.
So far, in this tutorial, we covered how to do manual, automatic correlation and how to use Logical actions. I’m sure that you will now have a clear understanding of correlation.
In our last tutorial part 4, will be discussing more on Scenario creation and test execution.