- Created by SS Doc Editor, last modified on Jun 07, 2022
StresStimulus automatically detects HTTP errors by checking response status codes of the emulated traffic. All responses with the status code of 400 and above are listed as errors in the Error Details report. However, this level of verification is insufficient to track down application-specific errors and exceptions. For this purpose, StresStimulus supports Validators that allow comparing responses against some expected values. Also, validators take precedence over the HTTP errors to make error reporting as granular as necessary. For example, one custom validator will recognize a database error message in response with status code 500, and another one will recognize a webserver error message in response with status code 500. As a result, 500 responses with a database error, 500 responses with a Webserver error, and 500 responses with other types of errors will be reported as three different error types.
A Validator is a rule of comparing a server’s response with a text pattern. In the case of a mismatch, a custom error is raised. Custom errors are reflected in test results. You can create validators for a single response (local) or all responses (global). To create a new validator: 1. Go to the Validators node on the Workflow Tree 2. Click Create a new Validator. A new validator dialog will appear. 3. Type the text or regular expression to search for in the response. If it's a regular expression, then set the Is text a regular expression? to Yes. Note: Starting from StresStimulus v5.4, the Text to search can be a variable expression. See below for the expression builder. 4. Change the Fail If setting if you want an error to occur if the text is found. The default is Not Found. 5. The Scope setting allows for changing the validator from local to global. 6. Change the Action if Failed setting to the following:
7. After that, complete the Description field with a meaningful definition of the error. Set this setting to Abort VU to stop the current VU from executing any more requests. 8. Click Add Validator when finished. Note: Validator's Description property is used to identify custom errors on StresStimulus test results. If the Description is empty, then the Text to search property is used to identify the custom error. |
Alternatively, you can create a validator for a recorded session by opening its session inspector and clicking Create Validator (a) on the toolbar. Another convenient way of creating validators is when comparing two sessions. In the Compare Sessions Inspector, select the Response tab, and on the toolbar of the replayed window on the right, click Create Validator (b). Note: You can highlight text in the replayed response before clicking the Create Validator button. This text will automatically populate the Text to the search field in the Create Validator dialog. |
Expression builder
The Text to match the property of a validator can be an expression, and it can be built using the Validator expression builder.
a. Click the 3 dots button in the Text to search property to bring up the Validator expression builder. It comes prefilled the recorded response text.
b. Select the text you wish to validate. Or replace the recorded text with a variable by selecting the value > right-click to bring up the variable picker > and select a variable
c. Click the Select Text button to copy the selected text to the Text to search property
Global Validators
Global validators are response validators that applied to all recorded responses that match a specified Content-Type.
Set the Content-Types property to one or more content types that the validator will apply to.
Note
If you provide more than one content type, they must be comma-separated.
- No labels