Variable extractors

A variable extractor extracts a string from the server response to the request and assigns the string to a variable. The variable extractor features two operating modes:

The Definition group box (simple mode) allows defining the extractor.

NL-VariableExtractorSimple-6.4

Variable name:The name of the variable automatically created to contain the value extracted. You need to use the expression ${VariableName}, which NeoLoad will replace with the value during the test.

Extract the value from: Extracts the value from either the body, the headers or both of the server response or the content of a NeoLoad variable. Extracting a variable from the content of another variable allows extracting a content in several steps. First extracts a part of the response based on a regular expression, then uses another regular expression to extract a part of that.

Expression: Ticking the check box allows selecting a node in the XML or JSON format response. The list box allows you to select the appropriate format. However, NeoLoad automatically detects the format and selects it accordingly.

Starting with: The phrase in the server response appearing immediately before the value to be extracted.

Followed by: The definition of the string main body. The extracted string is the concatenation of all the parts selected for extraction.

Ending with: The phrase in the server response appearing immediately after the value to be extracted.

Occurrence to extract: If the definition is matched more than once, select the occurrence to be used. The default value is "1" (use the first occurrence) but you can choose to use a random occurrence or all occurrences (useful with loops).

If you choose to process all the matched occurrences, the following variables are automatically created:

Value is encoded as: When this option is checked, a decoder is applied on the value before it is placed in the variable. You can choose between HTML, URL and Custom decoding.

Example with HTML: With the string start&end extracted from the server response, the value in the NeoLoad variable will be start&end if the option is checked, and start&end if the option is not checked.

Edit decoder: When you have selected Value is encoded as "Custom", click this button to provide the decoding logic in JavaScript that you want to be used to decode the extracted value.

In the Test zone, the Value extracted from recorded content field displays the result of the current extractor applied to the recorded content. If not defined, it can be modified manually in the Recorded response tab of Advanced parameters or through the Update recorded content.

The Definition group box (advanced mode) allows performing the extraction on the server response using a regular expression.

NL-VariableExtractorAdvanced-6.4

Variable name: The name of the variable automatically created to contain the value extracted.

Extract the value from: Extracts the value from either the body of the server response, XML nodes using XPath expression, the headers of the server response or both, or the content of a NeoLoad variable . Extracting a variable from the content of another variable, allows extracting a content in several steps. First extract a part of the response based on a regular expression, then use another regular expression to extract a part of it.

Expression: Ticking the check box allows selecting a node in the XML or JSON format response. The list box allows you to select the appropriate format. However, NeoLoad automatically detects the format and selects it accordingly.

Regular expression to match: The regular expression used to extract the value. Within the expression, the parts to be extracted must be enclosed in brackets (valid: value="(.+?)", invalid: value=".+?"). For more information, see Regular expressions.

Occurrence to extract in the page: If the definition is matched more than once, select the occurrence to be used. The default value is "1" (use the first occurrence) but you can choose to use a random occurrence or all occurrences (useful with loops).

If you choose to process all the matched occurrences, the following variables are automatically created:

Value template: The template used to construct the value. This is an arbitrary string containing special elements that refer to groups within the regular expression (a group is a dynamic portion of the regular expression set within brackets): $0$ refers to the entire text matching the expression, $1$ refers to group 1, $2$ refers to group 2, and so on. Using an illegal group will cause the extraction to fail and the value <NL-Illegal-groupIndex> will be set in the variable during the test. This typically arises when no brackets are specified in the regular expression to be matched.

Value is encoded as: When this option is checked, a decoder is applied on the value before it is placed in the variable. You can choose between HTML, URL and Custom decoding.

Example with HTML: With the string start&amp;end extracted from the server response, the value in the NeoLoad variable will be start&amp;end if the option is checked, and start&end if the option is not checked.

Edit decoder: When you have selected Value is encoded as "Custom", click this button to provide the decoding logic in JavaScript that you want to be used to decode the extracted value.

Stop extraction at the first match: This option allows considering the first value extracted for a looping request. When this option is selected, the variable extractor is stopped as soon as an extraction is done. The behavior is local to every Virtual User.

Predictable randomization. When this option is selected, randomly generated values have comparable values for two identical tests. Randomization returns the same values set per Virtual User.

In the Test zone, the Value extracted from recorded content field displays the result of the current extractor applied to the recorded content. If not defined, it can be modified manually in the Recorded response tab of Advanced parameters or through the Update recorded content.