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.
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.
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).
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 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.