Setting Expected Response Codes

Applies to LoadComplete 4.97, last modified on May 20, 2019

When running a load test, LoadComplete automatically verifies the actual status code of responses received from the tested server against the response codes the scenario specifies. It posts the verification results to the test log:

  • OK - The actual response status code is the same as the recorded one. For example, both are 200 OK or 302 Found.

    This applies to the 4xx Client Error and 5xx Server Error codes as well. For example, the response will be marked OK if both recorded and actual codes are 404 Not Found or 500 Internal Server Error, even if these codes indicate an error situation.
    In other words, LoadComplete verifies the equivalence of the actual and recorded status codes regardless of the meaning of those codes.

  • Warning - The actual status code differs from the recorded one. For example, the recorded response code is 200 OK and the actual one is 404 Not Found, or vice versa.

  • Error - An error occurred during request simulation. To learn in which cases LoadComplete reports errors, see Resolving Errors.

Note: If a request is redirected unexpectedly during simulation (though it was not redirected during the recording), LoadComplete will validate the code of the successive server response rather than the actual 3xx Redirection response. To learn more, see Handling Unexpected Redirects.
If a request is declined unexpectedly during simulation due to the absence of credentials (though it was accepted during the recording), and a 401 Unauthorized response is received, LoadComplete will attempt to send an authentication request automatically. If the authorization passes, LoadComplete will validate the code of the successive server response rather than the initial 401 Unauthorized response. To learn more, see Automatic Authentication.

You can configure LoadComplete to report various response codes for a request in a way you need.

If an error occurs during request simulation, LoadComplete will report the request results as an error regardless of the actual response code of the request and the Expected Codes settings. To learn when LoadComplete reports errors, see Resolving Errors.

Setting Response Codes for all Requests in a Scenario

  1. Open a scenario in the Scenario Editor. To do this, double-click the scenario in the Project Explorer or right-click the scenario and then click Edit.

  2. Select the top-level Scenario operation and switch to the Expected Codes page.

  3. Right-click in the page and then click New Item.

  4. In the Response Code column, enter the response code to handle. For example, 302.

  5. In the Treat as column, select the way LoadComplete should report this response code: OK, Warning, or Error.

  6. Select File | Save from LoadComplete main menu to save the changes.

You cannot add the same Response Code twice. If you paste a code that coincides with an existing code in the Expected Codes table, the pasted code will replace the existing one.

If a request has its own expected code specified, LoadComplete will ignore the scenario expected codes for this request. It will use the expected codes of the request.

If a scenario calls other subscenarios, then its expected response codes are ignored. Use a subscenario's expected response codes instead.

Setting Response Codes for an Individual Request

In the Request Editor
  1. Open a scenario in the Scenario Editor. To do this, double-click the scenario in the Project Explorer or right-click the scenario and then click Edit.

  2. Select the request, for which you want to customize the response code handling.

  3. Open the Response page and switch to the Expected Codes panel.

  4. To enable custom reporting of a specific response code:

    • Right-click in the Expected Codes panel and then click New Item. This will add a new item to the tab.

    • In the Response Code column, specify the response code to be handled. For example, 302.

    • In the Treat as column, select the way LoadComplete should report this response code: OK, Warning, or Error.

  5. To disable custom reporting of a specific status code:

    • Right-click the appropriate rule in the Expected Codes panel and then click Delete.

  6. Select File | Save from LoadComplete main menu to save the changes.

From the Test Log
  1. Open the list of the requests simulated during the test run. To do this, double-click the Details item of the needed test result in the Project Explorer.

  2. In the Details panel, find the needed request.

  3. The Status Code column contains the response code LoadComplete received from the tested server during the test run. (If the column is hidden, click Field Chooser on the panel toolbar and add the column to the panel).

  4. Right-click the request and then click the needed Mark Received Response Code as item.

LoadComplete will add the response code to the Expected Codes panel of the request. You can later disable custom reporting of this response code.

See Also

Editing Scenarios
Verifying Server Responses
About Scenario Editor

Highlight search results