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: The text to search can include extractors that were defined in previous responses. For instance: id={{item_id}}

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:

      • Abort Iteration to stop the current iteration, mark it as failed, and start a new one.
      • Abort VU to stop the current iteration, mark it as failed, don't start any more iterations by this VU.
      • Continue to continue the current iteration.

       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, and this text will automatically populate the Text to the search field in the Create Validator dialog.


You can easily see the recorded response text of the session you are trying to create a validator for. 

a. Click the 3 dots button in the Text to search property to bring up the Text to validate selector

b. Select the text you wish to validate

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.

If you provide more than one content-type, they must be comma-separated.