Make the parameter dynamic manually
If automatic configuration fails, you will need to define the variable extractor manually.
Search for the request whose response contains the value to be extracted
You have already found the parameter whose replayed value is invalid. You now have to find the request whose response contains the server-generated value to be extracted.
In the example, the id parameter was submitted with a value of "1193061773021" during the recording. You can search for the request whose response contains this value.
To search for the value to be extracted, follow these steps:
-
In the User Paths tab, click on the node that corresponds to the User Path.
-
In the Flags section, select the last option whose recorded response contains and enter the value "1193061773021"
.
-
NeoLoad places a check mark against the requests whose responses contain the entered value, in the example it is the request
/jpetstore/shop/index.html
-
You have now located the request whose response contains the value for the parameter to be processed. You can check to make sure it is the value you want and whether the parameter really needs to be processed.
To check the parameter, follow these steps:
-
Open the validation window and select the identified request (
/jpetstore/shop/index.html
). Right-click on the request in the User Path, and use the Select in validation window command to automatically open the validation window with the selected request displayed. -
Compare the response obtained during the validation with the one obtained during the recording:
-
Make sure the Response option box is checked in the Details section.
-
Click on the Compare with recording button.
-
-
The comparison tool reveals that the
id
parameter value is generated in this response and that the value has changed. Therefore, this parameter must be handled individually.
Extract the parameter value
You now need to extract the value of the id
parameter from the /jpetstore/shop/index.shtml
request. To do this, you will need to use a Variable Extractor.
To create a Variable Extractor, follow these steps:
-
Select the
/jpetstore/shop/index.shtml
request. -
Click on the Advanced Parameters button.
-
Click on the Variable Extractor tab.
-
Click + (plus).
In the example, you can extract the myId
variable from the server response body. Extract the content starting with id=
and ending with " shape
.
For more information about extracting and injecting variables, see Create a variable extractor.
Globally replace the parameter in the recording
Once you have completed the extraction and placed the parameter value in a variable, named "myId
" for example, you will then look at how to replace the value recorded in the scenario with the created variable.
To globally replace the parameter in the recording, follow these steps:
-
Run the wizard using NeoLoad Edit > Search and replace command.
-
This wizard allows you to automatically replace the value of the
id
parameter with themyId
variable. Select the first option Search in request parameters, then click Next to go to the next step. -
Select Search names and values and replace, then click Next to enter the search parameters.
-
Fill in the first field with the value previously used for the
id
parameter, "1193061773021". Put the replacement value "${myId}" in the second field. Use the variable picker if necessary. -
Once you have selected the variable, click Next, then Finish. A dialog box allows you to replace each occurrence of the value "1193061773021".
-
The window in the top left-hand corner allows you to navigate through each occurrence and indicate whether or not the replacement should apply. The pages containing the parameter in question are marked in the scenario tree. Moreover, the parameter found is highlighted in yellow in the request parameters. Click on the Replace or Replace all buttons to replace the value.
-
You can see that the
id
parameter value has been replaced by themyId
variable. Replace each occurrence of theid
parameter to make the entire scenario dynamic.