 |
AppPerfect Functional Tester for Web Applications |
Tutorial : Validation of a Functional Test
This tutorial provides a brief introduction to the Functional Tester product of the
AppPerfect Test Studio using a set of hands-on practice exercises. This tutorial assumes you have
successfully downloaded and installed AppPerfect Test Studio on your machine with the default
options. 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
- Creating Common Project
- AppPerfect Functional Tester
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\TestStudio folder and will
be referred as TESTSTUDIO_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 Common Project
In AppPerfect Test Studio, you can create a common project and use the same project to perform tests in all
the bundled products.
Exercise 1: Launch AppPerfect Test Studio
Action:
- Click on Start -> Programs ->AppPerfect Test Studio x.x.x -> AppPerfect Test Studio
- On launching AppPerfect Test Studio a Welcome page will be displayed. Go through the brief description
given for each product and click on the product icon to view its perspective.
NB: Welcome page is displayed only when Test Studio x.x.x is launched and last time no project
was opened.
- To switch between different product perspectives click on corresponding project button in toolsbar.
Exercise 2: Creating a Common Project
Action:
- Launch the Common 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. We don't have to provide
"Notification" settings. 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 common project we will create tests to demonstrate the functionalities of AppPerfect
Functional Tester product.
AppPerfect Functional Tester
NB:Please follow the steps provided in the "Creating Common Project" section to first create a common project,
then proceed further.
Exercise 1: Define a Functional Tester project
Action:
- Once the common project is successfully created another dialog - Define Project Properties dialog -
will be displayed.
- The dialog shows various options which can be configured for the project, in "Where N=",
specify 2 for two iterations. Click on OK button.
- 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 Test Studio product documentation
- Open the Preferences dialog by selecting the menu option Tools -> Options...
- Review the default settings for Functional Tester and click the OK button to close the dialog.
| NOTE:
|
AppPerfect Functional Tester uses Microsoft Internet Explorer's
COM interface to record and replay Web browser events. Hence, it only works on Windows 2000, Windows XP
and Windows 2003 and requires Microsoft Internet Explorer 5.0 or higher browser to be installed.
AppPerfect Functional Tester is not supported on Linux, Solaris or Mac OS X.
|
Exercise 2: Recording a Test
Action:
- Start tomcat server by selecting Start->Programs->AppPerfect LoadTest
x.x.x->Documentation and Examples->Examples->Tomcat running Petstore->Start Server.
- 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://localhost:8082/petstore". In the authentication select "No Authentication". Now Click on
'Start recording' button.
- An instance of Microsoft Internet Explorer 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.
- In IE click on link "Birds" to see list of products available in "Birds" category.
- Click on link "Amazon Parrot" to see details of this product.
- Click on "Add to Cart" to add Amazon Parrot.
- Check out by clicking on the Check Out link.
- Here, under "Are You a returning customer - Yes.", enter username as j2ee and password as j2ee.
Click Submit.
- Sign out of PetStore by clicking on Sign-out at top right of screen.
- Close browser by clicking on File -> Close in the browser window.
- Click on the Stop button of "Record a test" dialog to stop the recording session.
- Click on Close button to close the 'Record a test' dialog.
- Save project by selecting File->Save menu.
- In the AppPerfect Functional Tester window, look at the tree on the left. Each action you
performed has been recorded.
- 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 3: Configuring Parameters in Test
Action:
- In the editor tree, select 'Parameters' to open the parameters settings table on the right hand side.
- Here, click on 'Add Parameter' button to add a parameter.
- In the 'Parameter Setting Dialog', enter 'userParam' as the parameter name.
- Select 'Fixed Values - Fetch value from list of fixed values provided' as Data Source.
- Choose 'Sequential' as parameter selection.
- Under Add Value, enter j2ee and click on the 'Add' button.
- Under Add Value, enter john and click on the 'Add' button.
- Click Ok.
- In the editor tree select the event which states something like 'keypress on text userName1 : j2ee'..
- Select attributes tab.
- Click on the attribute name 'TextValue' in the attribute table.
- Click on the 'parameterize' button.
- In the parameterization settings dialog, select TextValue under the name column
in the parameter settings table.
- On selection, in the value group, 'Constant' will be selected with the value j2ee in
the text box.
- Select 'Parameter' and from the combo box, select userParam. This will use the values
of userParam as username on each iteration.
- Click Ok.
Exercise 4: Configuring Text Validation
Action:
- In the editor tree select the task which states something like 'Welcome to the BluePrints Petstore'.
- In the tree on the right hand side, right click and select 'Add Text Validation'
in the pop-up menu.
- This will bring up the 'Text Validation Settings' dialog.
- Under description enter 'userNameText'.
- Under 'Check for', select 'Exact match' and enter j2ee.
- Click Ok. What this basically does is that when this page loads (on
replaying), it will search the page for the text j2ee and
if it is not found, the validation will fail. Since we
have parameterized the username, on the 2nd iteration,
the username passed will be john which does not exist. As
a result of which, this page will not replayed as
expected and the validation will fail.
Exercise 5: Configuring Element Attribute Validation
Action:
- In the editor tree select the task which states something like 'Sign-on'
- Expand the right-hand side tree and select the element 'userName1' which will
highlight the 'UserName' text box under 'Are you a returning customer - Yes'.
- Right-click on this element and select 'Add Validation'.
- This will bring up the 'Add Vaidation' dialog. Check 'Validate' for the row whose
property name is 'value' and property value is 'j2ee'.
- Click Ok.
- Select the 'Validation' tab below. In the validation table, select the validation just added and
click 'Parameterize..' button.
- This will bring up the 'Parameterization Settings Dialog'. Here change the constant value
from j2ee to john.
- Click Ok.
- What this basically does is that when this page loads (on replaying), it will confirm
the value in the text box with john. Since in both our
iterations, the initial value (when the page loads) will
be j2ee, the validation will fail in both iterations.
Exercise 6: Executing a test
Action:
- To execute the test, click on Project -> Run from the menubar.
- You can see the AppPerfect Functional Test iterate through each recorded url/event and for the username
and password events, the parameter values will be substituted accordingly.
- After 2 iterations Functional Testing will stop and it will switch to Results view. In Result view you can
analyze the final result.
- Stop running tomcat server by selecting Start->Programs->AppPerfect Test Studiox.x.x->Documentation and
Examples->Examples->Tomcat running Petstore->Stop Server.