To create a data replacer:
-
Create a variable that will store the value you want to insert into your request:
-
To create a project variable that will store a value extracted from an external data source or generated by LoadComplete, use the Variable wizard.
-
To create a scenario variable that will store data extracted from an earlier response, define a rule that will extract the data. See Extracting Data From Responses. LoadComplete will create the variable to store the extracted data automatically.
If you have a project variable and a scenario variable with the same name, the data replacer will use the scenario variable.
-
-
(Optional.) If needed, create a variable that will contain an expression defining the data fragment to replace.
-
Specify where you want to insert data:
-
Request headers
-
Request cookies
-
Bodies of POST requests
-
Content of WebSocket client messages that pass text information
-
Content of Rich Internet Application (RIA) requests
-
-
To insert data to an individual request, select it in the Scenario Explorer and switch to the Data Replacers tab:
To insert data to all requests in a scenario, select the top-level Scenario node and then switch to its Data Replacers page:
-
Create a new data replacer:
To replace data in an arbitrary place in the request’s body or header
To replace a parameter value on a web form or in a Rich Internet Application request
To replace data in an arbitrary place in the request’s body or header
-
Right-click within the tab and then click Create data replacer with wizard. This will call the Create Data Replacer wizard that helps you create data replacers.
Creation of data replacers for the entire scenario with the wizard is not supported. To learn how to create a data replacer manually, see below. -
Follow the wizard instructions to create a data replacer that LoadComplete will use for replacing data in the request.
-
The wizard will create a data replacer and add it to the replacers list.
— or —
-
Right-click within the Data Replacers tab and then click
New Item. This will add a new row to the Data Replacers tab.
-
In the Area column, select Body (RegExp) or Header (RegExp) correspondingly.
-
In the Expression column, enter the data to be replaced or a search pattern. If necessary, you can use a regular expression.
You can also specify a variable containing the search pattern. Use the following syntax:
\vVariableName\v
– or –@VariableNameIf you need to concatenate a variable value with another variable or data, use the \vVariableName\v format:
data1\vVariable1\vdata2\vVariable2\vdata3
@VariableName values cannot be concatenated.
-
If the specified regular expression matches a large piece of data, you can use subexpressions to clarify the portion of data to be replaced. In the Attributes column, enter the index of the needed subexpression in the
$number
format, where number is the subexpression position in the regular expression.
For information on supported expressions, see Regular Expressions Syntax.
To replace a parameter value on a web form or in a Rich Internet Application request
-
Right-click within the Data Replacers tab and then click
New Item. This will add a new row.
-
In the Area column, select Body (Path).
-
For a web form, enter the parameter name in the Expression column. For example,
ctl00%24MainContent%24username
. You can find the parameter name on the Request Body panel of the recorded request.For a Rich Internet Application request, enter the full name of the request parameter, starting from the top-level node. For example,
Message[1]/[1]/clientID
. You can find the parameter path in the Path column of the Request Body panel of the recorded request.You can also specify a variable containing the needed parameter name. Click
and select the needed variable in the resulting dialog, or enter the variable name manually, in the @VariableName format.
Note: You can also insert the needed variable to the web form or Rich Internet Application request directly on the Request Body page. See Inserting Variables in Rich Internet Application Requests and Inserting Variables Into Web Forms. To replace a request’s header parameter
-
Right-click within the Data Replacers tab and then click
New Item. This will add a new row.
-
In the Area column, select Header (Path).
-
In the Expression column, enter the path to the request’s URL parameter you want to replace. You can find the needed path in the Request Header panel.
You can also specify a variable containing the needed parameter name. Click
and select the needed variable in the resulting dialog, or enter the variable name manually, in the @VariableName format.
Note: You can also insert the needed variable in the request’s header directly on the Request Header panel. See Inserting Variables Into URLs and Inserting Variables Into Request Header Fields. To insert a cookie
-
Right-click within the Data Replacers tab and then click
New Item. This will add a new row.
-
In the Area column, select Cookie.
Note: For setting cookie values, we recommend using Cookie in the Area column rather than Header (Path) or Header (RegExp). -
In the Expression column, enter the cookie name. You can also click
and select a variable containing the needed cookie name, or specify the variable name manually, in the @VariableName format.
-
In the Attributes column, enter the cookie’s attributes (if needed). See Cookie Replacer Attributes.
-
-
In the Variable column, select the variable whose data you want to insert.
Note: LoadComplete automatically adds the @
prefix to the variable name, if you forget about this. -
Select File > Save from LoadComplete main menu to save the changes.
When you simulate the scenario, LoadComplete will use the specified criteria to find the data in a request (or requests) and replace it with the variable value.
See Also
Regular Expressions Syntax
Extracting Data From Responses
Using Variables
About Data Replacers
Editing Recorded Requests