qtp 8.0 basics

95
Using QuickTest Professional 8.0 (Basic)

Upload: dwiner

Post on 12-Nov-2014

1.878 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: QTP 8.0 Basics

Using QuickTest Professional 8.0(Basic)

Page 2: QTP 8.0 Basics

Mercury QuickTest Professional• Introduction to QTP− QuickTest Professional, the Mercury advanced keyword-driven testing solution

enables you to test standard Windows applications, Web objects, ActiveX controls, and Visual Basic applications. You can also acquire additional QuickTest add-ins for a number of special environments (such as Java, Oracle, SAP Solutions, .NET Windows and Web Forms, Siebel, PeopleSoft, Web services, and terminal emulator applications).

Page 3: QTP 8.0 Basics

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.

Page 4: QTP 8.0 Basics

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.

Page 5: QTP 8.0 Basics

QTP Window

Page 6: QTP 8.0 Basics

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.

Page 7: QTP 8.0 Basics

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).

Page 8: QTP 8.0 Basics

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 setting when QuickTest was first installed.

Page 9: QTP 8.0 Basics

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"•Save step screen capture to results " On error and warnings"

Page 10: QTP 8.0 Basics

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

Page 11: QTP 8.0 Basics

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.

Page 12: QTP 8.0 Basics

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.

Page 13: QTP 8.0 Basics

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)

• QuickTest should be running before the application under test is invoked. For some environments, this is mandatory.

Page 14: QTP 8.0 Basics

Saving a TestSaving the test in Quality Center• 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:

1. Select your folder

2. Type in the test name

3. Save the file

Save a test in QuickTest Professional• If you are using QuickTest Professional alone the file system you will save to is under the

QuickTest Professional’s test directory.• You have the option to save the test results along with the test.

Page 15: QTP 8.0 Basics

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.

Page 16: QTP 8.0 Basics

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 the step currently running.• When QuickTest finishes running the test, you can open the Test Results window.

Page 17: QTP 8.0 Basics

Steps to View the Results

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

Page 18: QTP 8.0 Basics

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.

Page 19: QTP 8.0 Basics

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.

Page 20: QTP 8.0 Basics

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.

Page 21: QTP 8.0 Basics

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 properties.

Page 22: QTP 8.0 Basics

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.

Page 23: QTP 8.0 Basics

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 sufficient, but changing a logical

name can give clarity to the test and the documentation that is generated.

Page 24: QTP 8.0 Basics

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.• During a test run, QTP uses the Test Object to search for a match in the application during run

time.

Page 25: QTP 8.0 Basics

Steps to change A Logical Name

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

Page 26: QTP 8.0 Basics

The Object Properties Dialog

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

Page 27: QTP 8.0 Basics

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.

Page 28: QTP 8.0 Basics

4. Synchronization Objectives

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

Page 29: QTP 8.0 Basics

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 completed so that the user/test

can take the next step.

Page 30: QTP 8.0 Basics

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.

Page 31: QTP 8.0 Basics

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 running a test and proceeds to the next step before the previous step has fully processed.

Page 32: QTP 8.0 Basics

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 to be synchronized.• From the QTP menu bar, choose INSERT STEP SYNCHRONIZATION POINT

Page 33: QTP 8.0 Basics

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:− Web, SAP, TE

Page 34: QTP 8.0 Basics

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.

Page 35: QTP 8.0 Basics

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.

Page 36: QTP 8.0 Basics

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.• For example, QuickTest can check the exact width and height of an object in pixels.

Page 37: QTP 8.0 Basics

Checkpoint Types

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

Page 38: QTP 8.0 Basics

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 is necessary.

Page 39: QTP 8.0 Basics

Standard Checkpoint

Page 40: QTP 8.0 Basics

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:

1. While in record mode, select INSERTCHECKPOINTSTANDARD CHECKPOINT. QTP should minimize and the hand icon should appear.

2. Click on the object you wish to check in the AUT.

3. Select “OK” to confirm that the object selected is correct item.

4. The CHECKPOINT PROPERTIES dialog opens.

5. 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.

6. Modify the value if required.

7. Click OK to insert the checkpoint into the test.

Page 41: QTP 8.0 Basics

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.• Right-click on the appropriate field and choose INSERT STANDARD CHECKPOINT.

Page 42: QTP 8.0 Basics

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 cannot modify the name of a checkpoint. As a best practice, insert a comment to document the reason for the checkpoint.

Page 43: QTP 8.0 Basics

A Variable Checkpoint Value

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

Page 44: QTP 8.0 Basics

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.

Page 45: QTP 8.0 Basics

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.

Page 46: QTP 8.0 Basics

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”.

Page 47: QTP 8.0 Basics

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.

Page 48: QTP 8.0 Basics

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.

Page 49: QTP 8.0 Basics

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.

Page 50: QTP 8.0 Basics

XML Checkpoint Checks the data content of XML documents in XML files or

XML documents in Web pages and frames.

Page 51: QTP 8.0 Basics

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.• Add the regular expression. For example, Figure will use [A-Z a-z]+.

Page 52: QTP 8.0 Basics

Some Regular ExpressionsExpression Character Description

Period . Matches any single character

Asterisk * Matches zero to any number of occurrences of the precedingCharacter

Plus + Matches one to any number of occurrences of the precedingcharacter

Brackets [A-Z] [a-z] [0-9]

Matches a range of characters Matches a range of numbers

Digit \d Matches any digit

\d{4} Matches exactly four digits

Page 53: QTP 8.0 Basics

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.• When the Comment field is listed in the keyword view, add your comment.

Page 54: QTP 8.0 Basics

6. Parameters Objectives

• Describe and use multiple parameter types.• Drive data in multiple iterations.• Analyze errors during iterations.• Parameterize a checkpoint.

Page 55: QTP 8.0 Basics

Data Table Parameters• 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).

Page 56: QTP 8.0 Basics

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.

Page 57: QTP 8.0 Basics

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.• Input parameter values are input into the application from some outside data source.

Page 58: QTP 8.0 Basics

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.• The Constant value appears in the Value Configuration Options dialog box.

Page 59: QTP 8.0 Basics

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.• Enter the values that QTP will input after the test executes.

Page 60: QTP 8.0 Basics

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.• If you want to show or hide the data sheet, click on the icon in the toolbar.

Page 61: QTP 8.0 Basics

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.

Page 62: QTP 8.0 Basics

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.

Page 63: QTP 8.0 Basics

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

Page 64: QTP 8.0 Basics

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.

Page 65: QTP 8.0 Basics

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 Selection window.

Page 66: QTP 8.0 Basics

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 the step currently highlighted in the Keyword

View.

Page 67: QTP 8.0 Basics

Re-Use Outputs As Inputs

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

Page 68: QTP 8.0 Basics

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.

Page 69: QTP 8.0 Basics

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.• Name - Create a name that will be used for a specific purpose in the test.

Page 70: QTP 8.0 Basics

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.

Page 71: QTP 8.0 Basics

Types of Environment Variables• User – Defined Internal• User – Defined External• Built – In

Page 72: QTP 8.0 Basics

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.

Page 73: QTP 8.0 Basics

Built-In Dialog Box

• A different list of choices will appear when the variable type Built-In is chosen.

Page 74: QTP 8.0 Basics

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.

Page 75: QTP 8.0 Basics

Types of Actions There are two kinds of actions:

• Regular (Non-reusable)• Reusable

Tests that contain reusable actions can be used:

• Locally• Externally

Page 76: QTP 8.0 Basics

A Test with Multiple Actions

• 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.

Page 77: QTP 8.0 Basics

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.

Page 78: QTP 8.0 Basics

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.

Page 79: QTP 8.0 Basics

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.

Page 80: QTP 8.0 Basics

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”

Page 81: QTP 8.0 Basics

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

Page 82: QTP 8.0 Basics

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.

Page 83: QTP 8.0 Basics

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.

Page 84: QTP 8.0 Basics

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.

Page 85: QTP 8.0 Basics

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.

Page 86: QTP 8.0 Basics

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 contained in each test appear in the Global or Local sheet depending on where you stored them in the original test.

Page 87: QTP 8.0 Basics

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.

Page 88: QTP 8.0 Basics

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.

Page 89: QTP 8.0 Basics

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.

Page 90: QTP 8.0 Basics

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.

Page 91: QTP 8.0 Basics

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.• An action tree displays all the details of the selected reusable or external action.

Page 92: QTP 8.0 Basics

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

Page 93: QTP 8.0 Basics

Multiple Reusable Actions When using multiple, reusable actions, keep the following in mind:• 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.

Page 94: QTP 8.0 Basics

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 non-reusable action.

Page 95: QTP 8.0 Basics

Thank You