Assertions are used to verify the expected page content. It is needed to make sure that the requested page has loaded correctly. If an HTTP request completes successfully with HTTP OK code, it does not necessarily mean that the page contents have loaded successfully. For example, log in to a web application may fail and a failed login message may be displayed back. From an HTTP perspective, the page would be successful but from an application point of view, a page hit may be considered a failure. A successful login may be verified by checking the received page response. The presence or absence of a certain text string or text pattern may signify the success or failure of the page.

In the Assertions tab, you can apply assertions on the created transactions to verify the expected result with the actual result. You can also ensure that the requested page has loaded correctly.

## Adding Assertion

To add an Assertion, you have the following fields to be filled:

Select the page(s)from the dropdown on which the assertion is to be applied.

### Assert

The Assert dropdown list displays the following option. The fields are dynamic and depend upon the option selected from the dropdown list:

- Content
- Complete response from a file
- Checksum

Let us discuss them in detail:

#### Content

On selecting Content, you will get the following options in the corresponding dropdown list:

- body: Content will be searched in the response body.
- header: Content will be searched in the response header.
- both: Content will be searched in both the response body and response header.

After selecting the content to be checked, we need to choose how the user wants to search for the content.

For that we have the following option:

- specific text

OR

- From mentioned the start and the end string.

Regular Expression: In the case of Regular expression, any special character in the text will be taken as Regular expression.

Ignore Case: Enable the checkbox to make the provided text non-case sensitive.

#### Complete response from a file

If you select Complete response from a file in Check, you have to choose the file in the file field.

#### Checksum

If you select Checksum in Assert, then you have to choose whether you want to check with Checksum or with Cookie.

- Checksum: Here user gives a checksum value which has to be compared with a checksum of response.
- Cookie: Here user specifies the cookie name which has to be compared with the Checksum of response.

### Failure Condition

There are two failure conditions on the basis of which action will be taken:

- Match text not found: It means that the assertion would fail if the text string or pattern were not found in the received response. If the FAIL argument is not specified, it is assumed to be NOTFOUND.
- Match text found: It means that the assertion would fail if the text string or pattern were found in the received response.

### Actions

Based on the above failure conditions following, you have the following action options:

- Stop Session: If the string that the user is searching for is not found, then Load Test displays CVFail in progress. report and event.log and stop the session.
- Continue Session: If the string that the user is searching for is not found, then Load Test continues its operation and the warning message will be logged in the event.log file.

Once the above failure and its action are selected, you have to type the failure message which can be seen when the failure condition is satisfied.

Save Occurrence count in Scratch Parameter: If you want to utilize assertion as a count parameter, then disable the checkbox for the failure condition and use the save count as a scratch parameter.

From the assertion list, the user can make changes to a particular assertion by clicking the edit or delete icon as per the requirement.