AJAX application Load Testing
Like DHTML, Ajax is not a technology in itself, but a term that refers to the use of a group of technologies. Ajax uses a combination of:
- HTML and CSS for marking up and styling information.
- A method for exchanging data asynchronously between browser and server, thereby avoiding page reloads. The XMLHttpRequest (XHR) object is usually used, but sometimes an IFrame object or a dynamically added <script> tag is used instead.
Note: The application "Bing" is used only for demo purpose and must not be used to run test with more than 1 virtual user. Also the test duration must not be more than 1 minute.
This tutorial provides a brief introduction to load testing AJAX applications using AppPerfect Load Test with hands-on practice exercises. This tutorial assumes you have successfully downloaded and installed AppPerfect Load Test on your machine with the default options and you are connect to Internet. Apart from this pre-requisite, this tutorial is self contained. Instructions given below are Windows-specific; if you are using a non-Windows machine, please use equivalent commands/instructions.
This document is divided into following sections
Within each section, multiple exercises are listed. Each exercise forms a logical unit which is expected to take no more than a few minutes to perform. All exercises use Microsoft's Bing site.
All exercises assume you have installed the product in C:\AppPerfect\LoadTest folder and will be referred as LOADTEST_HOME henceforth in tutorial. If you have installed the product in some other folder, modify the instructions below appropriately.
This tutorial is not intended as a comprehensive training guide. Please refer to the product documentation for detailed information. However, this tutorial will give you a very good overview of the products and substantially improve your productivity with the product.
Exercise 1: Launch AppPerfect Load Test
- Click on Start -> Programs ->AppPerfect Load Test x.x.x -> AppPerfect Load Test
- On launching AppPerfect Load Test a Welcome page will be displayed. Go through various sections provided in the welcome page.
NB: Welcome page is displayed only when Load Test x.x.x is launched and last time no project was opened.
Exercise 2: Creating a Project
- Launch the Project Wizard by clicking File ->New... menu option. The New Project wizard will be launched.
- Keep the default project name and location for the purpose of this exercise. Click on the OK button.
- A confirmation message saying that the project is saved will be displayed. Click on the OK button.
Now using this project we will create tests to demonstrate the functionalities of AppPerfect Load Test product.
AppPerfect Load Test
NB: Please follow the steps provided in the "Creating Project" section to first create a project, then proceed further.
Exercise 1: Define a Load Test project
- Once the project is successfully created another dialog - Define Project Properties dialog - will be displayed.
- Change the default settings as shown in this dialog as Test Duration:1min, Load Type:Loop, Loop Count:3, Virtual Users:1.
- Go through the description given for Loop load type at the bottom.
- Review other settings in the Panel and click on the Finish button to close this dialog.
- Click through all the menu items to familiarize yourself with the available features and how to access them. Viewing through all menu items will give a reasonable overview of the application.
- Click Help -> Table of Contents menu item to see AppPerfect Load Test product documentation
- Open the Preferences dialog by selecting the menu option Tools -> Options...
- Review the default settings for Load Test and click the OK button to close the dialog.
Exercise 2: Recording a Test
- To start recording, click on Project -> Record test... in the menu bar.'
- 'Record a test' dialog will be displayed. Select ActionGroup1 from the Group combo. Provide starting URL as "http://www.bing.com". Now Click on 'Start recording' button to start recording.
- An instance of configured browser will be launched with the Bing's home page loaded. This home page has a search field. Enter "Load Test" in the search text field and press Enter or click on the Search icon.
- This will take us to the search results page.
- Now move the mouse over the first entry. Keep the mouse more on the right hand side of the entries. You will find a rectangle filled with light brown color. If you take your mouse over this circle. It will pop up a pointer box that shows contents of the site which will be directed to if you click on the search entry.
- Browser sends a request to the server to get the contents of the search entry asynchronously. This request though not visible to the user (as it happens when a page refreshes etc) is a request sent to the server and is recorded by AppPerfect Load Test.
- Click on Stop recording in the recording dialog box. It will prompt you with a Passthrough parameter resolution dialog. Normally, it is good to resolve the passthrough parameters after recording itself, but we will do it in the next exercise, hence select Cancel in this dialog. Close the recording dialog.
- Check the recorded tasks in the Editor tree. Check the tasks with Path [/captionHandler.aspx]. All these tasks are asynchronous requests made by browser to the server. AppPerfect Load Test has successfully recorded all these tasks.
Exercise 3: Resolving Pass-through Parameters in Test
- Pass-Through Parameter are request parameter whose value needs to be extracted from previous responses and passed to subsequent requests. Recording of HTTP/HTTPS tasks for Load Testing has completed. Application has arranged the recorded tasks as Main tasks (Html responses) and sub-tasks (images, css, js, etc.) in the test. For correct execution of the test script, all Pass-Through parameters needs to be resolved correctly.
- In the editor tree, select 'ActionGroup1' and select 'Resolve Pass-through parameters' from Project Menu.
- Click on Ok to start the automated resolving of the passthrough parameters.
- It will start executing the test in an interactive manner where you will be able to see recorded response & replayed response of each task along with other request details. Application will prompt a dilaog box if it identifies any passthrough parameter and waits for your confirmation.
- In this exercise it will identify 'IG' as a Pass-through parameter. Select Ok in the dialog box when you are prompted for the same.
- AppPerfect Load Test has resolved the pass-through parameters successfully, and during replaying it will extract the value of IG from appropriate Task's response and pass it to all the request where it is required to be sent.
Exercise 4: Verify test in browser
- Before actually testing if the server can handle desired load, we should verify if the test replays fine with single virtual user. In order to verify the test, click on Project -> Verify Test using Browse... from the menubar. Select Ok in this dialog.
- Load Test will start replaying the test and show the response of each task as it gets executed in the dialog along with other details like parameters passed, request headers passed to the server etc.
- Verify that the test replays fine and check response of each task by selecting and confirm that it meets the requirement.
Exercise 5: Executing a test
- Now you are ready to load test the server. Click on Project -> Run from the menubar.
- Check the status of the test in Status view. Once the execution completes, you will be taken to Result's view where you can view the test execution results.