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, then 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, then 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 that will extract the selected value.
The JPath description can be found at this location.
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
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