Specifying the expected response code

Response code verification points verify that the response code matches an expected value. If the returned code is does not match, the test log reports a failed verdict event. You can specify an exact response code or verify that the code is within the same category.

About this task

You can either change the preferences so that Response Code verification points are set automatically for all the tests or you can configure each test setting. To set response code in the preferences:
  1. Change subsequent tests that you record. Click Window > Preferences > Test > Test Generation > HTTP Test Generation > Automatically include verification point of, select HTTP Return Code and click Relaxed or Exact. This changes subsequent tests that you record.
  2. Optionally, regenerate existing tests with the changed preference, as shown in Generating a new test from a recorded session.

Procedure

To set response code setting for a test:
  1. In the Test Navigator, browse to the test and double-click it.
    The test opens.
  2. Right-click the test name, a test page, or a request, and select Enable Response Code VPs.
    Your choice determines whether a verification point is added to every request in the test, to every request in a page, or to a particular request. The following figure shows a response code verification point within a test:response code folder
    Note: When you modify a test, the modified items appear in italic type. The italic type changes to regular type after you save the test.
  3. Click the verification point to display the response code editing fields in the Test Element Details area.
  4. To disable an individual response code verification point, clear the Enable verification point field.
  5. From the Select matching method list, click an option to indicate how closely the returned response code must match the recorded value.
    OptionDescription
    Relaxed If the recorded response code is 200, 201, 202, 204, 206, 301, 302, or 304, then a returned response code of any of those values causes the verification point to pass. If the recorded response code is any other value, it is the same as if you had specified an exact match.
    Exact An error is reported if the returned response code does not match the recorded value.