QuickTest Window
The QuickTest window contains the following key elements: − QuickTest title bar—Displays the name of the currently open test or component. − Menu bar—Displays menus of QuickTest commands. − File toolbar—Contains buttons to assist you in managing your test or component. − Testing toolbar—Contains buttons to assist you in the testing process. − Debug toolbar—Contains buttons to assist you in debugging your test or component (not displayed by default). − Action toolbar—Contains buttons and a list of actions, enabling you to view the details of an individual action or the entire test flow. − Test pane—Contains the Keyword View and Expert View tabs. − Active Screen—Provides a snapshot of your application as it appeared when you performed a certain step during the recording session.

Continued…
− Data Table—Assists you in parameterizing your test or component. For a test, the Data Table contains the Global tab and a tab for each action. For a component, the Data Table contains single tab. − Debug Viewer pane—Assists you in debugging your test or component. The Debug Viewer pane contains the Watch Expressions, Variables, and Command tabs (not displayed by default). − Status bar—Displays the status of the QuickTest application.

QTP Window

1. Prepare to Record
Objectives
• • •

Review documented user steps of a business transaction. Understand the application under test and its environment. Prepare the test environment to utilize QuickTest Professional correctly.

Add-in Manager

QTP’s Add-ins helps you to create tests and components for applications that use a variety of environments. Once an add-in is loaded, you can record on that application in its supported environment and recognize the objects specific to the application under test (AUT).

QuickTest Professional Options>General

A best practice when setting general options for QuickTest are to: •Deselect all check boxes except “Save data for integrating with performance testing …” and “Display Add-in Manager on startup”. •Click on “Restore Layout” button to reset screens to the initial

QuickTest Professional Options>Run

A best practice, when setting run options for QuickTest are to: •Enable the normal mode. this ensures that the execution arrow appears to help with trouble shooting your test. •You can choose to have the test results appear after each test run or not. •Select "Allow other Mercury products to run tests and components"

Record and Run Settings Windows
•

•A best practice is to use the options to configure QTP to "Record and run test on any open Windows- based application" •This window will appear the first time you click on the Record button in the new test. •Manually recall this window by selecting Test->Record and Run settings

2. Create a Test
Objectives
• • • •

Create a basic test from a manual test case. Run a test and check for errors. Store the test file. Discuss the importance of initial and end conditions.

The User Interface

•

The QuickTest Professional user interface is broken up into a number of functional areas. You can choose to focus on one or more areas depending on the task you are performing.

Record a Test

•

Once the record button is pressed and test steps are performed , QuickTest listens and records the activities. This results in the recording and storing of each step of the business process. Each step consists of: − The object − The method (operation) − The method property (a value for the action performed on the object)

Saving a Test
Saving the test in Quality Center
• • • • • 7. 8. 9.

Only relevant when using QTP with QC A bulls-eye symbol in the header with “Open Test from Quality Center” appears A folder structure is listed under the parent directory “Subject” You have the option to click the File System button on the upper right corner Once you have logged into Quality Center: Select your folder Type in the test name Save the file If you are using QuickTest Professional alone the file system you will save to is under the QuickTest Professional’s test directory.

Save a test in QuickTest Professional
• •

Steps to Run a Test

− − −

From the QTP Toolbar, click on the Run Button. A best practice is to use the temporary folder to hold the results while debugging your test. Press the OK button to execute the Run command.

Viewing the Test Run

• •

When you run a test, QuickTest performs each step as it was recorded. You can watch in the AUT as QuickTest performs each step. A yellow arrow in the left margin of the KEYWORD VIEW points out

Steps to View the Results

1. 2. 3. 4.

Decide if results must be viewed. If yes, select TEST->RESULTS from the QTP menu bar. View the outcome of the test run. Expand the results tree. From the Test Results menu bar, select

View Test Results

•Failure “roll-up” to the parent at the top level of the tree. •Expand the Test Results tree to see the outcome of each step. •Navigate to the child step that caused the failure.

3. The Object Repository
Objectives
• • • • • •

Define what a Quick Test Professional object is. Describe the role of the Object repository Identify a given object as part of a class. Describe how objects are recognized by Quick Test Professional. Use the Object Repository to find and add objects. Change object logical names using the Keyword View.

Object Types

• •

A Quick Test Professional object is a graphic user element in an application, such as a button or a drop-down list. Objects are categorized into classes. Buttons, Graphic Images and Edit Boxes are a few examples of class types.

QuickTest Object Properties

• • • •

In the example above, there are several objects called Buttons, two of which are: Update Order Delete Order. The only way to distinguish one object from the other of the same class is by the difference in object characteristics. Specific characteristics of an object within QuickTest are called object

QuickTest Recognizes Objects
• •

QuickTest uses a method when it learns objects during the recording process. QuickTest first looks at the object you are recording and stores it as a test object, determining its object class. For example, QuickTest might classify the test object as a standard Windows dialog box or a web button. For each object class, QTP has a default set of properties that it always learns. Usually, only a few properties are needed to uniquely identify an object.

• •

Assigning a Logical Name

• • • •

After learning the class and properties of an object, QTP assigns a name to the object. This is known as the object’s logical name. QTP refers to the object in a recorded test by using its logical name. Edit the logical name to make it more descriptive if you wish. The logical name given to an object during recording may be

Stored Test Objects

• • • •

Recorded object properties are stored in QTP’s Object Repository. Each test has its own Object Repository, by default.. These “stored” objects are referred to as “ Test Objects”. The purpose of a Test Object is to represent application objects in the test.

Steps to change A Logical Name

You can change an object’s logical name in the OBJECT REPOSITORY. 2. Right-click on the object at the KEYWORD VIEW level. 3. Choose OBJECT PROPERTIES. 4. Click on the REPOSITORY button.

The Object Properties Dialog

2. 3. 4. 5.

Once in the Object repository: Right-click the object in the repository tree. Choose RENAME. Type a descriptive name for the object. Click OK.

QuickTest Documentation

• •

QuickTest updates the object name and documents it in the documentation field of the Keyword View. IMPORTANT: if you start a brand new test, the test will record the original, default object names in the Object Repository.

4. Synchronization
Objectives
• • •

Define Synchronization. Examine when and where synchronization is most helpful. Add a synchronization step for a specified object.

What is Synchronization ?

•

Synchronization is a step added to a test that instructs QuickTest to wait for the state of a property on a particular object to change before proceeding to the next step in the test. This is done while in RECORD mode. The user/test waits for a visual indication that a step has

• •

Some Visual Cue Examples
•

A progress bar reaches 100% completion. A status message appears. A button becomes enabled. A window opens and is ready for data entry. A pop-up message appears in response to an operation.

•

•

•

•

Examine the Application

Quick Test defaults to allocating the same amount of time for every object.
•

Wait times often occur before an object becomes available for the next step. For example, in the Flights application, once the Insert Order button has been clicked, a process bar must complete to yield the Order No. associated with the reservation. The process bar may require additional time before the test can proceed. If insufficient time is allocated for these special circumstances, the test may fail. The error message “Object not enabled” appears if QuickTest is

Add a Synchronization Step While Recording

•

Synchronization points which instruct QuickTest to pause until an object property achieves a specific value.The easiest method is to add a synchronization point while recording. A Synchronization step can be added manually after a test is recorded , as well. Always add the synchronization point immediately after the step

• •

Object Synchronization

• • • •

When the synchronization timeout is set for a step, this value is added to the global timeout value. QTP has a default timeout between test steps of 20000 milliseconds (20 seconds). This feature applies to environments that do not synchronize automatically. Examples of auto-synchronizing environments:

5. Checkpoints
Objectives
• • • • •

Validate test success by using standard checkpoints. Set checkpoints on a single object property. Add flexibility to a constant value by using a regular expression. Use the Test Results feature to analyze test success or failure. Add a comment to a step.

What is a Checkpoint?
• • • •

A checkpoint is a specialized step in QuickTest that compares two values and reports the result. The values can be one of the object properties shared by the value generated by the application. QuickTest will compare actual results from the test run with expected results in out test plan. If the two values match, the checkpoint passes. Using Checkpoints

• • •

A recorded test is not considering valid without verification. Some reasons for this may be to: Confirm that the test’s action procedure intended results. These results should adhere to company business rules.

Visual Cues

• •

A checkpoint is a measurable result or display that indicates the system is functioning as expected. For example, when a reservation is created manually in the Flight application, we know that it succeeded because the application generates an order number. This order number is a visual cue. Any event you can see on the screen can be used as a visual cue. QuickTest can check parts of an application which are not visible on-screen.

• •

Checkpoint Types

• • • • • • • •

The following are the types of checkpoint: Standard Text TextArea Bitmap Database Accessibility XML (Web and File)

Standard Checkpoint
• •

Enables you to check the state of object properties such as text buttons, checkboxes and radio buttons. When a Standard Checkpoint is inserted, the Checkpoint Properties dialog window appears, providing available property information for the specified object class. The standard checkpoint checks for a constant or parameterized property value of an object in the application or web page. Notice the Type field in the Properties window. An icon shows the type of checkpoint that can be set. A checkpoint can be added for an object during or after recording. Note: A checkpoint is a special type of synchronization point. If you are checking the property of the object that you would normally synchronize on, an additional synchronization point

•

• •

•

Standard Checkpoint

A Constant Checkpoint Value
As a default, QuickTest assumes the value to check is a constant. This value is generated within the AUT. To add a checkpoint:
•

While in record mode, select INSERTCHECKPOINT STANDARD CHECKPOINT. QTP should minimize and the hand icon should appear. Click on the object you wish to check in the AUT. Select “OK” to confirm that the object selected is correct item. The CHECKPOINT PROPERTIES dialog opens. Choose the properties you want by entering a check and unchecking all others. The value of the selected property appears in the CONSTANT edit box. Modify the value if required. Click OK to insert the checkpoint into the test.

• • • •

• •

Insert A Checkpoint From The Active Screen

• •

A checkpoint can be added after a test is created. Use the Active Screen to select the field on which the checkpoint will be added.

A Failed Checkpoint

• • •

What happens when the value of the object you are checking changes from the original recorded Value (i.e., Agent Name)? The test checkpoint must be modified to accommodate changing values. You can tell that a checkpoint has been added to a test when you view the Test Result. A check mark appears next to the step. You

A Variable Checkpoint Value

• •

To allow for any value generated by the application for the property you specify, use the regular expression capability.

Bitmap Checkpoint
• •

Checks an area of your Web page or application as a bitmap. For example, suppose you have a Web site that can display a map of a city the user specifies. The map has control keys for zooming. You can record the new map that is displayed after one click on the control key that zooms in the map. Using the bitmap checkpoint, you can check that the map zooms in correctly.

Table Checkpoint
Checks information within a table. For example, suppose your application or Web site contains a table listing all available flights from New York to San Francisco. You can add a table checkpoint to check that the time of the first flight in the table is correct. Note: You create a table checkpoint by inserting a standard checkpoint on a table object.

Text Checkpoint
Checks that a text string is displayed in the appropriate place in your application or on a Web page. For example, suppose your application or Web page displays the sentence Flight departing from New York to San Francisco. You can create a text checkpoint that checks that the words “New York” are displayed between “Flight departing from” and “to San Francisco”.

Text Area Checkpoint
Checks that a text string is displayed within a defined area in a Windows application, according to specified criteria. For example, suppose your Visual Basic application has a button that says View Doc <Num>, where <Num> is replaced by the four digit code entered in a form elsewhere in the application. You can create a text area checkpoint to confirm that the number displayed on the button is the same as the number entered in the form.

Database Checkpoint
Checks the contents of a database accessed by your application.
•

For example, you can use a database checkpoint to check the contents of a database containing flight information for your Web site.

Accessibility Checkpoint
Identifies areas of your Web site that may not conform to the World Wide Web Consortium (W3C) Web Content Accessibility Guidelines. For example, guideline 1.1 of the W3C Web Content Accessibility Guidelines requires you to provide a text equivalent for every non-text element. You can add an Alt property check to check whether objects that require the Alt property under this guideline, do in fact have this tag.

XML Checkpoint
Checks the data content of XML documents in XML files or XML documents in Web pages and frames.

Use a Regular Expression

•

• • •

A regular expression is a string that specifies a complex search phrase. By usingspecial characters you define the conditions of the search. From the Checkpoint Properties window, ensure Constant is enabled and click on the note paper icon. Check Regular Expression checkbox. If QTP sees there are characters that can be misconstrued as a regular expression, it will ask you to treat it as a literal character. Generally, you will answer No.

Some Regular Expressions
Expression Period Asterisk Character . * Description Matches any single character Matches zero to any number of occurrences of the preceding Character Matches one to any number of occurrences of the preceding character Matches a range of characters Matches a range of numbers Matches any digit Matches exactly four digits

Plus

+

Brackets Digit

[A-Z] [a-z] [0-9] \d \d{4}

Add a Comment

• • •

The default QuickTest Professional Keyword View does not show the Comment field. Add the comment field by right-clicking on the harder field of the keyword view. The list shows displayed fields with a check mark next to them; add the comment field from here.

Input Parameter - allows you to run a test using different sets of data input values. Output Parameter - allows you to use output to capture values from the application at runtime. When you use a data table parameter, you must instruct QuickTest on where the input data will come form. Other Parameter Types Random Number – a system generated number inserted into the parameter field during a test run. Environment – a variable describing a software or hardware object in the AUT environment. For example: the OS version or local host name. Component – a parameter type that is used while implementing business process testing (BPT).

• • •

•

Input Parameters For Data driven Tests
• •

Input Parameters For Data Driven Tests A data-driven test is one that runs a set of user actions with multiple input values. Data driving allows one script to test application functionality with many sets of data. Automated data driven testing frees you to perform more tests, thus increasing test coverage. Speed, repeatability, free resources to do other kinds of quality control.

•

Input Parameter

•

Input Parameters allow you to replace a static, recorded value in a step with a dynamic placeholder (parameter), which represents an expandable range of values. Input parameter names and their values are located in QuickTest’s Data Table.

•

Steps to Create An Input Parameter

• • •

To create an input data table parameter: Select the step in the Keyword View that contains the recorded input value. From the Value column, click on the current value. Click on the parameterize button.

Set the Parameter Value

•

•

•

In the VALUE CONFIGURATION OPTIONS dialog, select the Parameter radio button and ensure that Data Table is selected from the drop-down list. From the Name drop down list, enter a unique column name to create a new column in your data table or choose an existing column name from the data table. Use the default Global data sheet to store values.

Supply Data to the Parameter

• • • •

The design-time table is the central location for storing input parameter values. The number of rows in the data table will cause the same number of test execution iterations to be run. As a default, the design-time data table is displayed at the bottom of the QuickTest screen.

Verify The Test Run

• •

View the Test Results window to verify that each of the rows from the Design Time Data Table was used during the test run. Expand the tree for each iteration (Row#) to view specific information about the execution of the specific row.

The Run-Time Table

• • • •

The run-time data table is: Created and saved with the Test Results. Created after a test is executed. A live version of the design-time table stored with your test.

Set the Number of Iterations

• • • • • •

Set the number of rows that will be driven into the test for the specified field in the Run Setting dialog box. The possibilities are: - Run one iteration - Run all rows - Run a range of rows

Output Parameter

• •

•

An output parameter is a value which comes back from the application under test. When you run the test, QuickTest retrieves the current value of the property and enters it in the run-time Data Table as an output value. You can subsequently use this output value variable in your test. We call this data correlation. This enables you to use data retrieved during other parts of a test.

Steps to Create an Output Parameter

• • • •

In the Keyword View, choose a step that contains the field whose value will be output. In the Active Screen, right-click on the field whose value you want to output. Choose Insert Output Value from the list. Verify the object you want to output by clicking OK in the Object

Output Value Properties

• • • •

Check only the object(s) you want to parameterize. Click on the Modify button. Choose or enter the column name to be used in the Global data sheet. Decide whether the output step should be placed before or after

Re-Use Outputs As Inputs

• •

Once an output parameter has been created, its value can be used in the subsequent steps of the test

Parameterize a Checkpoint

• • •

You can use parameterized expected values to make your checkpoints dynamic. They Can be set on: An object property in the Object Repository. A checkpoint on a parameterized field.

Random Number – Input Parameter

•

• •

Random Number – QuickTest can generate random numbers and input them as values for a parameter.By default, the random number ranges between 0-100 A different random number is generated each time the parameter is called, for each iteration or for each test run. You can modify these settings in the Parameter Options dialog box.

Environment Parameter

•

• •

QuickTest can insert a value from the Environment variable list. These values can be either QuickTest related or they can relate to the system environment. Use of an environment parameter requires an understanding of system values and some programming skills. Throughout the test run, the value of an environment variable remains the same, regardless of the number of iteration performed, unless you reset the value of the variable in your script.

Types of Environment Variables
• • •

User – Defined Internal User – Defined External Built – In

User Defined Dialog Box

• •

When a user-defined environment is set, the dialog box presents a list of both internal and external with the associated values.

Built-In Dialog Box

•

A different list of choices will appear when the variable type BuiltIn is chosen.

7. Reusable and Multiple Actions
Objectives
• • • •

List the types of actions that can be created. Discuss the benefits of reusable actions. Call a reusable action from an external test Discuss how the reusable actions affect data and parameters.

Actions can be divided into logical sections, like the main sections of a transaction, or by specific business processes. When you create a new test, it contains one action. By dividing your tests into multiple actions, you can design more modular and efficient tests.

•

Insert Call to a New Action

• • •

You can add a new action during or after recording. Select Insert ? New Action from the QuickTest main menu. The Insert New Action window appears. Or use the “lego” icon on the toolbar to insert new action.

Using Parameterized Data

• • • •

Test data can be passed from one test to another test using the value of an input parameter. This creates a data flow between business processes. The value passed from one business process to another will come from the Data Table. Be aware of any data dependencies that occur within the business process.

Data Table Sheets - Global

The Global Data Sheet:
• • •

Enables you to create a new column or select an existing column in the Global sheet of the Data Table. Inserts or outputs a value from or to current row of the global data sheet during each global iteration at run-time. Provides a source of values that can be seen and used by any action.

Data Table Sheets - Local

• • • •

When a Local Data Sheet is used: The parameters and data will appear with different tabs in the main calling test’s Data Table. It allows you to iterate reusable actions independently of any other called actions. You will need to link parameters in the “main calling test”

Copied, Existing or New Action

• • • •

After reusable actions are created, they can be called into a “Main Calling” test in three ways: Call to New Action Call to Copy of Action Call to Existing Action

One Action used Many Times

•

Rather than recording the login process three times in three separate tests, and enhancing this part of the script (with checkpoints and parameterization) separately for each test, you can create an action that logs into the application in one test. Best Practice Inserting calls to existing actions makes it easier to maintain our tests; when an object or procedure in your application changes. It only needs to be updated one time, in the original action.

•

Set Actions as Reusable

• •

Create a reusable action from the Action properties dialog. Check the checkbox and click OK. A message will appear stating a description of a reusable action.

On Action – Two Names

• • •

Use the Action Properties – General tab to modify the default label. This makes the test easier for others to understand when viewing the test from the Keyword View tree. Right-Click on Action and enter a logical name for the business process.

Call An Action

• • • •

• • •

You can do number of things with a reusable action, such as: Call it multiple times within a test. Call it from other tests. View the components of the action tree (you cannot modify them except in the original script). Insert a call to an external action (the action is inserted in read-only format) - as local editable copy - use the (read only) data from the original action Insert copies of non-reusable actions into your test, but you cannot insert calls to non-reusable actions.

External Action Properties

•

•

•

An external action is a reusable action created in another test. The external action is inserted into the calling test in a read-only format. Data from the external action’s data sheet can be imported as a local, editable copy or kept as read only. If read-only, the data can only be modified from the original test. After a reusable action is called, you will see the parameters

Action Run Settings

•

Since there are two (or more) tests running, one right after another, you may need to specify the iteration for each separately. To affect the run settings for a particular action, set them in the Action Call Properties dialog box. Right-Click on the Action label in the Keyword View, and choose Action Call Properties from the list provided.

• •

Defining an Action

• •

The Action Properties dialog box enables you to define options for the stored action. You can modify an action name, add or modify an action description, and set an action as reusable.

Passing Values to a Called Action

• •

You can also define input and output parameters to be used by the action. These settings apply each time the action is called.

Using an Action Parameter

•

Once parameters have been set in Action Properties, you can tell QuickTest that the parameter type being used is an Action Parameter.

The Test Flow List

• • • •

The Test Flow List: - Changes with the addition of a reusable action. - Enables viewing of the action tree for a selected reusable or external action. The test flow appears when a test is recognized as having called actions in your test.

Action Data Structure
• • • •

In the Action data structure, each Action will have its own: Folder with an object repository Local data table sheet Run settings

Actions can be called or copied from another test. Run settings have to be set per action As a default, all actions in a test use the same shared Object Repository. Parameters and data from the called test are reflected in the calling test An action can be deleted or an action call can be deleted. Position your action calls separately or nest them with other actions.

Delete an Action

• •

Because reusable actions can be used throughout your test or test set, when you delete an action, you must decide to delete a specific occurrence of the action and/or all of its calls.

A different message appear when you are about to delete a nonreusable action.