Your Script is written to run multiple concurrent users. But how can you make sure that all users are logged on successfully? We have to check the validity of the pages that are loaded for each virtual user executing the script. This can be done by adding a check option on a web request.
By default, the recording process adds a check option on every primary web request in order to verify the title of the page (this option can be changed in the recording options if desired).
This tutorial will show you how add a check on a request and use it to verify the availability of your application.
We add a check on a login request. This check will verify if our user John is well logged in the AgileLoad bookstore website.
In the script, go to the login request by placing the cursor on the line where the main request is (this will be denoted by having the word PRIMARY), and show request details by clicking on the Record Request Details button (), a yellow arrow will then appear in the left margin of the script editor to show that the HTTP Data window content is relating to that line in the script:
In the HTTP Data view (to the right of the script), in the Server tab (middle of the window), go to the HTML tab (at the bottom of the HTTP Data Window).
Select “Welcome John Smith” and right click on it. In the menu, select Insert Check Point.
The Check assistant will appear with your selected text. Add a name to this check, “Login”.
Click on the Apply button and the request in the script will be modified to include the code for the check (see highlighted text below)
You can add multiple checks on a single request, use the Check assistant to help you add checks.
The Check Contains option tells the check to search for the presence of a character string in the HTTP response to the request (and its associated sub-requests) that is selected in the script. The Check Condition verifies either status return code, body size or enables you to create your own condition with SubStr parser, HTML parser, XML parser or other functions.
The excerpt above will behave as follows:
1st line example: If response contains a response code of 200 (HTTP OK) then continue and do not fail the check, if the response code is not 200 then continue anyway but raise the check as failed.
2nd line example: If the HTTP content is greater than 500 bytes then continue and fail the check, if <= 500 bytes then continue and do not fail the check.
3rd line example: In the HTTP content, Substr function go to “Shopping Cart” character string position and extract character string between first “title=”” character string and “””, if the extract character string is not “Les Mesirables” then continue and fail the check, the character string is “Les Miserables” then continue and do not fail the check.
The Check name is very important as it will help you to identify the failure. The check name will appear if the check fails in the Replay Details list in script editor, in the Audit Log message and in the Checks View in AgileLoad Test Center when running a test or analysing results.
Next Validate your check