- Created by SS Doc Editor, last modified on Jun 07, 2023
Header extractors (a) return a response header's value. To define the Header Extractor, select the header name from the Header (a) drop-down.
For instructions on how to set other Header extractor properties, see the section Text Delimited Extractors.
If a response is a web form, you can use Form Field (b) extractors. For example, they return a web form field value, a value of any HTML textbox or hidden field. To define a Form Field Extractor, select the field name from the Form Field (c) drop-down.
If a response is XML, then you can use an XPath Extractor. The difference between XPath extractors and text delimited extractors is that you need to define an XPath query instead of delimiters.
The XPath tutorial can be found at this location.
JSON Jpath Extractor
If a response is JSON, you can use a JPath Extractor (d). The difference between JPath extractors and text delimited extractors is that you need to define a JPath query (e) instead of delimiters. You can also use the JPath creator feature by selecting the value you want to extract and clicking the Create JPath button (f) or by right-clicking and selecting Create JPath Query (g) in the context menu. StresStimulus will automatically create a general JPath extractor to extract the selected value.
The JPath description can be found at this location.
JPath query builder
To build a more complex JSON Jpath query, you may use the JPath Query builder.
To bring up the JPath Query builder, press the ... button in the property grid in the JPath query property,
In the appeared builder:
- The response JSON will be formatted and indented for easier reading
- Enter the JPath query in the Resulting JPath Query textbox
- To check JPath query syntax and correctness, click Verify JPath Query button to evaluate the JPath query against the recorded JSON.
- Alternatively, create a general JPath query by selecting the value you want to extract and clicking the Create JPath button.
- Click Save to save the query to the JPath query property
Return objects
Starting from v5.6, if the JPath query returns an object, the extractor will return a text representation of the object.
XML XPath Extractor
If a response is XML, you can use an XPath Extractor (i). The difference between XPath extractors and text-delimited extractors is that you need to define an XPath query (j) instead of delimiters. You can also use the XPath creator feature by selecting the value you want to extract and clicking the Create XPath button (k) or by right-clicking and selecting Create XPath Query (l) in the context menu. StresStimulus will automatically create a general XPath extractor to extract the selected value.
The XPath description can be found at this location.
XPath query builder
To build a more complex XML XPath query, you may use the XPath Query builder.
To bring up the XPath Query builder, press the ... button in the property grid in the XPath query property,
In the appeared builder:
- The response XML will be formatted and indented for easier reading
- Enter the XPath query in the Resulting XPath Query textbox
- To check the XPath query syntax and correctness, click Verify XPath Query button to evaluate the XPath query against the recorded XML.
- Alternatively, create a general XPath query by selecting the value you want to extract and clicking the Create XPath button.
- Click Save to save the query to the XPath query property
Multiple occurrence queries
If an XPath of JPath query returns more than one value, the Occurrence property must be set appropriately. By default, the first return value will be used for the extractor. To use the second matching value, the Occurrence property should be changed from 1 to 2. To do so:
- Click Verify Extractor on the toolbar and compare the Extractor Check window's value with the expected value.
- If an incorrect value is displayed, find the matching value's correct occurrence by clicking Next/Previous Occurrence until you find the correct value.
- Click Set The Occurrence to properly adjust the Occurrence property.
- If the occurrence should be determined during the test (random), set the Occurrence Type property to Random and set the Min Occurrence and Max Occurrence properties to the desired range. For more on the random occurrence, see here.
- To select the last possible occurrence, set the Occurrence Type property to Last.
- No labels