Functional Testing a Web Application

This tutorial provides a brief introduction to the AppPerfect Web Test product using a set of hands-on practice exercises. This tutorial assumes you have successfully downloaded and installed AppPerfect Web Test on your machine with the default options. Apart from this pre-requisite, this tutorial is self contained.

This document is divided into following sections

  1. Creating Project
  2. AppPerfect Web Test

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 the PetStore demo application running inside Apache Tomcat. The modified PetStore application and Tomcat are both bundled with this product.

All exercises assume you have installed the product in C:\AppPerfect\WebTest folder and will be referred as WebTest_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.

Creating Project

Exercise 1: Launch AppPerfect Web Test

  1. Click on Start -> Programs ->AppPerfect Web Test x.x.x -> AppPerfect Web Test
  2. On launching AppPerfect Web Test a Welcome page will be displayed. Go through the brief description given for product.

Exercise 2: Creating Project

  1. Launch the Define New Project dialog by clicking File ->New... menu option. The New Project wizard will be launched.
  2. Keep the default project name and location for the purpose of this exercise. Click on the OK button.
  3. 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 Web Test product.

AppPerfect Web Test

NB:Please follow the steps provided in the "Creating Project" section to first create a project, then proceed further.

Exercise 1: Define a Web Test project

  1. Once the common project is successfully created another dialog - Define Project Properties dialog - will be displayed.
  2. The dialog shows various options which can be configured for the project, leave them default and click on OK button.
  3. 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.
  4. Click Help -> Table of Contents menu item to see AppPerfect Web Test product documentation
  5. Open the Preferences dialog by selecting the menu option Tools -> Options...
  6. Review the default settings for Web Test and click the OK button to close the dialog.

Exercise 2: Recording a Test

  1. Start tomcat server by selecting Start->Programs->AppPerfect Web Test x.x.x->Documentation and Examples->Examples->Tomcat running Petstore->Start Server.
  2. To start recording, click on Project -> Record test... in the menu bar.'
  3. 'AppPerfect Recorder' dialog will be displayed. Select the browser with which you need to record from the Browser drop down. Select ActionGroup1 from the Group combo. Provide starting URL as "http://localhost:8392/petstore". In the authentication drop down select "HTML Form based Login" and provide user name: "j2ee" and password :"j2ee". Now Click on 'Start recording' button.
  4. An instance of selected browser will be launched with the PetStore home page loaded. Click on enter the store link. This will populate the database and display the PetStore main page. Note that populating the database might take some time.
  5. Click on each link on the left: Birds, Reptiles, Dogs, Cats, Fish
  6. Order an item by clicking on: Birds -> Amazon Parrot -> Adult Male Amazon Parrot -> Add to cart
  7. Modify the quantity and click on Update Cart button.
  8. Check out by clicking on the Check Out link.
  9. At the 'Sign in' page, default values are already provided. Click on Submit.
  10. Sign out of PetStore by clicking on Sign-out at top right of screen.
  11. Close browser by clicking on File -> Close in the browser window.
  12. Click on the Stop button of "AppPerfect Recorder" dialog to stop the recording session.
  13. Click on Close button to close the 'AppPerfect Recorder' dialog.
  14. In the AppPerfect Web Test window, look at the tree on the left. Each action you performed has been recorded.
  15. Click on any of the recorded action on the left. The page associated with that action is displayed along with the actual element highlighted on the right hand side.

Exercise 3: Creating required parameters

  1. In the editor tree, select 'Parameters' node.
  2. On right hand side, click on 'Add Parameter' button to add a parameter.
  3. Select 'Fixed Values' as Data Source. Select Next button.
  4. In the 'Parameter Setting Dialog', enter 'sampleParam' as the parameter name.
  5. Under Add Value, enter 2 and click on the 'Add' button.
  6. Under Add Value, enter 3 and click on the 'Add' button.
  7. Choose 'Sequential' as parameter selection.
  8. Click Finish.
  9. In the editor tree select the event which states something like (set on WebInputField 27:).
  10. In the details tab Click on the "text" argument in the Event Arguments table.
  11. Click on the 'parameterize' button.
  12. In the parameterization settings dialog, select "text" under the name column in the parameter settings table.
  13. 'Constant Value' will be selected with the value 27 in the text box.
  14. Select 'Parameterize' and from the combo box, select sampleParam. This will use the values of sampleParam as item quantity on each iteration.
  15. Click Finish.
  16. Now if the test is replayed for two iterations then each time different value will be picked for Item quantity.

Exercise 4: Adding page validations

  1. Select the URL "Items" in the Editor tab.
  2. Right click on the DOM Tree on the right and select the option 'Validate HTML source'.
  3. This will validate all the elements & content of the web page when the test is replayed and report any validation error if there is any mismatch found in the recorded and replayed web page.

Exercise 5: Executing a test

  1. Go to Project -> Properties.... menu to open Web Test project properties dialog. Change the 'No. of iterations' value to 2 and click OK.
  2. To start replay of the recorded test, click on Project -> Run from the menu bar.
  3. An instance of default browser configured at Tools -> Options -> Browsers is launched and each of the recorded events is replayed. No manual intervention is required during test replay, unless an error is encountered.
  4. Note that two different values are picked for Item quantity for each iterations.
  5. Stop running tomcat server by selecting Start->Programs->AppPerfect Web Testx.x.x->Documentation and Examples->Examples->Tomcat running Petstore->Stop Server.

Exercise 6: View and analyze results

  1. After replay, results are displayed in Results tab.
  2. Click on Results tab. Test results details are displayed on the right. Click on individual items in the tree on the left to view details on specific actions.
  3. Browse and examine the different views that are displayed on selecting the various nodes in the navigation tree.
  4. Select the ActionGroup node. This report gives a summary of the successful, failed, timed-out & not played URLs & Events.
  5. Select the URL Item and click on the Validation Results tab on the right. Here you will find the details of the successful / failed validations.