Validation Rules

Testing web applications and APIs is not as simple as just sending requests. You’ll also need to make sure the responses come back as expected every time.

Loadster automatically detects many types of errors. Anytime your application (or the server it is running on) returns an HTTP 4xx or 5xx response code, Loadster will automatically recognize it as an error. Network errors, like socket timeouts or closed connections, are also automatically detected.

Errors that are unique to your application, however, might not be automatically recognized as errors. Your application might show an error message to the user, or it might return an altogether different page than your script was expecting.

You can check for these more subtle errors with validation rules.

When to Use Validation

Examples of when you might need to use custom validation rules include:

  • Making certain a key page loads in less than 3.0 seconds.
  • Making certain the response includes the word “Welcome” when you submit the registration form.
  • Making certain the words “User not found” do not appear in the response when you log in.
  • Making certain a specific response is always more than 15kb and less than 25kb.

When you’re testing web applications or APIs, it’s a good idea to add validation rules throughout your script to eliminate uncertainty about the responses. Otherwise, certain types of errors might go undetected.

Creating a Validator

You can add a validation rule to an HTTP step, by clicking on the Add… button.