Web Testing

Parameterizing a Web test

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 Common 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.
    NB: Welcome page is displayed only when Web Test x.x.x is launched and last time no project was opened.
Exercise 2: Creating a 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 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. In Test Replaying tab, "Where N=", specify 3 for three iterations since we shall be demonstrating the test using two parameters each having three parameters values using unique values for each test. 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: Creating required parameters

To demonstrate parameterization, we will consider the "Account" page of Petstore which has a login page that takes a user name and a password. For this we will be defining three different parameters values each for login and password to be used while replaying the test.

  1. Start tomcat server by selecting Start->Programs->AppPerfect WebTest x.x.x->Documentation and Examples->Examples->Tomcat running Petstore->Start Server.
  2. Start web browser and enter the URL to load the petstore app. i.e. "http://localhost:8392/petstore"
  3. Click on link "enter the store".
  4. Click on link "Account".
  5. Here, Under "No. I would like to sign up for an account.", create three user accounts. For this tutorial we'll assume the following three user accounts:
    • Account 1: username - john, password - smith.
    • Account 2: username - sam, password - bradley.
    • Account 3: username - pet, password - store.

    We shall be leaving default information for "Contact Information" on submitting the new username and password. Sign-out and repeat process to add all the usernames and passwords.

  6. Finally sign-out and close the browser.
Exercise 3: Recording a Test
  1. To start recording, click on Project -> Record test... in the menu bar.'
  2. '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 select "Basic Authentication" and provide user name: "john" and password :"smith". Now Click on 'Start recording' button.
  3. 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.
  4. In IE click on link "Birds" to see list of products available in "Birds" category.
  5. Click on link "Amazon Parrot" to see details of this product.
  6. Click on "Add to Cart" to add Amazon Parrot.
  7. Check out by clicking on the Check Out link.
  8. Here, under "Are You a returning customer - Yes.", enter username as john and password as smith. Click Submit.
  9. Sign out of PetStore by clicking on Sign-out at top right of screen.
  10. Close browser by clicking on File -> Close in the browser window.
  11. Click on the Stop button of "AppPerfect Recorder" dialog to stop the recording session.
  12. Click on Close button to close the 'AppPerfect Recorder' dialog.
  13. Save project by selecting File->Save menu.
  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.
Exercise 4: Configuring Parameters in Test
  1. In the editor tree, select 'Parameters' to open the parameters settings table on the right hand side.
  2. Here, 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 'userParam' as the parameter name.
  5. Under Add Value, enter john and click on the 'Add' button.
  6. Under Add Value, enter sam and click on the 'Add' button.
  7. Under Add Value, enter pet and click on the 'Add' button.
  8. Choose 'Sequential' as parameter selection.
  9. Click Finish.
  10. Click on 'Add Parameter' button to add another parameter.
  11. Select 'Fixed Values' as Data Source. Select Next button.
  12. In the 'Parameter Setting Dialog', enter 'passParam' as the parameter name.
  13. Under Add Value, enter smith and click on the 'Add' button.
  14. Under Add Value, enter bradley and click on the 'Add' button.
  15. Under Add Value, enter shop(a wrong password as per the user account we created for username pet, the correct password was "store") and click on the 'Add' button.
  16. Choose 'Sequential' as parameter selection.
  17. Click Finish.
  18. In the editor tree select the event which states something like 'set on WebInputElement userName1 : john'.
  19. In the details tab Click on the "text" argument in the Event Arguments table.
  20. Click on the 'parameterize' button.
  21. In the parameterization settings dialog, select "text" under the name column in the parameter settings table.
  22. On selection, in the value group, 'Constant' will be selected with the value john in the text box.
  23. Select 'Parameterize' and from the combo box, select userParam. This will use the values of userParam as username on each iteration.
  24. Click Ok.
  25. In the editor tree select the event which states something like 'set on WebPasswordElement passWord : c21pdGg='. Its the second event below the event which states 'set on WebInputElement userName1 :john'.
  26. In the details tab Click on the "text" argument in the Event Arguments table.
  27. Click on the 'parameterize' button.
  28. In the parameterization settings dialog, select text under the name column in the parameter settings table.
  29. On selection, in the value group, 'Constant' will be selected with the value smith in the text box.
  30. Select 'Parameterize' and from the combo box, select passParam. This will use the values of passParam as the password on each iteration.
  31. Click Finish.
Exercise 5: Executing a test - Watching the parameters in action.
  1. To execute the test, click on Project -> Run from the menubar.
  2. You can see the AppPerfect Web Test iterate through each recorded url/event and for the username and password events, the parameter values will be substituted accordingly.
  3. After 3 iterations Web Testing will stop and it will switch to Results view. In Result view you can analyze the final result.
  4. Stop running tomcat server by selecting Start->Programs->AppPerfect Web Testx.x.x->Documentation and Examples->Examples->Tomcat running Petstore->Stop Server.