tutorial on qtp 8.0

95
8/14/2019 Tutorial on QTP 8.0 http://slidepdf.com/reader/full/tutorial-on-qtp-80 1/95 Using QuickTest Professional 8.0 (Basic)

Upload: kapil-samadhiya

Post on 30-May-2018

223 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 1/95

Using QuickTestProfessional 8.0(Basic)

Page 2: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 2/95

 

Mercury QuickTest Professional

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

driven testing solution enables you to test standardWindows applications, Web objects, ActiveX controls, andVisual Basic applications. You can also acquire additionalQuickTest add-ins for a number of special environments(such as Java, Oracle, SAP Solutions, .NET Windows andWeb Forms, Siebel, PeopleSoft, Web services, andterminal emulator applications).

Page 3: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 3/95

 

QuickTest Window

The QuickTest window contains the following key elements:

− QuickTest title bar—Displays the name of the currently opentest or component.

− Menu bar—Displays menus of QuickTest commands.

−File toolbar—Contains buttons to assist you in managing yourtest or component.

− Testing toolbar—Contains buttons to assist you in the testingprocess.

− Debug toolbar—Contains buttons to assist you in debuggingyour 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 theentire 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 therecording session.

Page 4: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 4/95

 

Continued…

−Data Table—Assists you in parameterizing your test orcomponent. 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: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 5/95

 

QTP Window

Page 6: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 6/95

 

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 QuickTestProfessional correctly.

Page 7: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 7/95 

Add-in Manager

QTP’s Add-ins helps you to create tests and components forapplications that use a variety of environments.

Once an add-in is loaded, you can record on that application in itssupported environment and recognize the objects specific to the

application under test (AUT).

Page 8: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 8/95 

QuickTest Professional Options->General

A best practice when setting general options for QuickTest are to:

•Deselect all check boxes except “Save data for integrating withperformance testing …” and “Display Add-in Manager onstartup”.

•Click on “Restore Layout” button to reset screens to the initial

Page 9: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 9/95 

QuickTest Professional Options->Run

A best practice, when setting run options for QuickTest are to:•Enable the normal mode. this ensures that the execution arrowappears to help with trouble shooting your test.• You can choose to have the test results appear after each testrun or not.

•Select "Allow other Mercury products to run tests andcom onents"

Page 10: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 10/95 

Record and Run Settings -Windows

•A best practice is to use the options to configure QTP to "Recordand run test on any open Windows- based application"• This window will appear the first time you click on the Recordbutton in the new test.

•Manually recall this window by selecting Test->Record and Runsettings

Page 11: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 11/95 

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: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 12/95 

 The User Interface

•  The QuickTest Professional user interface is broken up into a

number of functional areas. You can choose to focus on one ormore areas depending on the task you are performing.

Page 13: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 13/95 

Record a Test

• Once the record button is pressed and test steps areperformed , QuickTest listens and records the activities. Thisresults in the recording and storing of each step of the businessprocess. Each step consists of:

− The object

− The method (operation)

− The method property (a value for the action performed on the

object)

Page 14: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 14/95 

Saving a Test

Saving the test in Quality Center• Only relevant when using QTP with QC

• A bulls-eye symbol in the header with “Open Test from QualityCenter” appears

• A folder structure is listed under the parent directory “Subject”

•  You have the option to click the File System button on the upperright corner

• Once you have logged into Quality Center:

7. Select your folder

8.  Type in the test name

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

Page 15: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 15/95 

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 theresults while debugging your test.

−Press the OK button to execute the Run command.

Page 16: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 16/95 

Viewing the Test Run

• When you run a test, QuickTest performs each step as it wasrecorded.

•  You can watch in the AUT as QuickTest performs each step. Ayellow arrow in the left margin of the KEYWORD VIEW points out

Page 17: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 17/95 

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

Page 18: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 18/95 

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: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 19/95 

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: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 20/95 

Object Types

• A Quick Test Professional object is a graphic user element in anapplication, 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: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 21/95 

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 thesame class is by the difference in object characteristics. Specificcharacteristics of an object within QuickTest are called object

Page 22: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 22/95 

QuickTest Recognizes Objects

• QuickTest uses a method when it learns objects during therecording process.

• QuickTest first looks at the object you are recording andstores it as a test object, determining its object class. Forexample, 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 uniquelyidentify an object.

Page 23: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 23/95

 

Assigning a Logical Name

After learning the class and properties of an object, QTP assigns aname to the object. This is known as the object’s logical name.

• QTP refers to the object in a recorded test by using its logicalname.

• Edit the logical name to make it more descriptive if you wish.

•  The logical name given to an object during recording may be

Page 24: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 24/95

 

Stored Test Objects

• Recorded object properties are stored in QTP’s ObjectRepository.

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

Page 25: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 25/95

 

Steps to change A Logical Name

 You can change an object’s logical name in the OBJECTREPOSITORY.

2. Right-click on the object at the KEYWORD VIEW level.

3. Choose OBJECT PROPERTIES.

4. Click on the REPOSITORY button.

Page 26: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 26/95

 

 The Object Properties Dialog

Once in the Object repository:

2. Right-click the object in the repository tree.

3. Choose RENAME.

4.  Type a descriptive name for the object.

5. Click OK.

Page 27: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 27/95

 

QuickTest Documentation

• QuickTest updates the object name and documents it in thedocumentation 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: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 28/95

 

4. Synchronization

Objectives

• Define Synchronization.

• Examine when and where synchronization is most helpful.

• Add a synchronization step for a specified object.

Page 29: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 29/95

 

What is Synchronization ?

• Synchronization is a step added to a test that instructs QuickTestto wait for the state of a property on a particular object to changebefore 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

Page 30: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 30/95

 

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: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 31/95

 

Examine the Application

Quick Test defaults to allocating the same amount of time forevery object.

• Wait times often occur before an object becomes available for

the next step. For example, in the Flights application, once theInsert Order button has been clicked, a process bar mustcomplete to yield the Order No. associated with the reservation. The process bar may require additional time before the test canproceed. If insufficient time is allocated for these specialcircumstances, the test may fail.

The error message “Object not enabled” appears if QuickTest is

Page 32: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 32/95

 

Add a Synchronization StepWhile Recording

• Synchronization points which instruct QuickTest to pause until anobject property achieves a specific value.The easiest method isto add a synchronization point while recording.

• A Synchronization step can be added manually after a test isrecorded , as well.

• Always add the synchronization point immediately after the step

Page 33: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 33/95

 

Object Synchronization

• When the synchronization timeout is set for a step, this value isadded to the global timeout value.

• QTP has a default timeout between test steps of 20000milliseconds (20 seconds).

•  This feature applies to environments that do not synchronizeautomatically.

• Examples of auto-synchronizing environments:

Page 34: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 34/95

 

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

• Use the Test Results feature to analyze test success orfailure.

• Add a comment to a step.

Page 35: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 35/95

 

What is a Checkpoint?

• A checkpoint is a specialized step in QuickTest that compares twvalues and reports the result.

•  The values can be one of the object properties shared by thevalue 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. Somreasons for this may be to:

• Confirm that the test’s action procedure intended results.

•  These results should adhere to company business rules.

Page 36: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 36/95

Page 37: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 37/95

 

Checkpoint Types

•  The following are the types of checkpoint:

• Standard

•  Text

•  TextArea• Bitmap

• Database

• Accessibility

XML (Web and File)

Page 38: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 38/95

 

Standard Checkpoint

• Enables you to check the state of object properties such astext buttons, checkboxes and radio buttons.

• When a Standard Checkpoint is inserted, the CheckpointProperties dialog window appears, providing availableproperty information for the specified object class.

•  The standard checkpoint checks for a constant orparameterized property value of an object in the applicationor web page.

• Notice the Type field in the Properties window. An icon showsthe type of checkpoint that can be set.

• A checkpoint can be added for an object during or afterrecording.

• 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

Page 39: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 39/95

 

Standard Checkpoint

Page 40: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 40/95

 

A Constant Checkpoint Value

As a default, QuickTest assumes the value to check is aconstant. This value is generated within the AUT.

To add a checkpoint:

• While in record mode, select INSERTCHECKPOINTSTANDARD 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 correctitem.

•  The CHECKPOINT PROPERTIES dialog opens.

• Choose the properties you want by entering a check andunchecking all others. The value of the selected propertyappears in the CONSTANT edit box.

• Modify the value if required.

• Click OK to insert the checkpoint into the test.

I t A Ch k i t F Th

Page 41: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 41/95

 

Insert A Checkpoint From TheActive 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.• -

Page 42: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 42/95

 

A Failed Checkpoint

• What happens when the value of the object you are checkingchanges from the original recorded Value (i.e., Agent Name)?

•  The test checkpoint must be modified to accommodate changingvalues.

•  You can tell that a checkpoint has been added to a test when youview the Test Result. A check mark appears next to the step. You

Page 43: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 43/95

 

A Variable Checkpoint Value

•  To allow for any value generated by the application for theproperty you specify, use the regular

• expression capability.

Page 44: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 44/95

 

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 keysfor zooming. You can record the new map that is displayedafter one click on the control key that zooms in the map.Using the bitmap checkpoint, you can check that the mapzooms in correctly.

Page 45: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 45/95

 

 Table Checkpoint

Checks information within a table.For example, suppose your application or Web site containsa table listing all available flights from New York to SanFrancisco. You can add a table checkpoint to check that thetime of the first flight in the table is correct.

Note: You create a table checkpoint by inserting a standardcheckpoint on a table object.

Page 46: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 46/95

 

 Text Checkpoint

Checks that a text string is displayed in the appropriateplace in your application or on a Web page.

For example, suppose your application or Web page displaysthe sentence Flight departing from New York to SanFrancisco. You can create a text checkpoint that checks thatthe words “New York” are displayed between “Flightdeparting from” and “to San Francisco”.

Page 47: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 47/95

 

 Text Area Checkpoint

Checks that a text string is displayed within a defined area ina Windows application, according to specified criteria.

For example, suppose your Visual Basic application has abutton that says View Doc <Num>, where <Num> isreplaced by the four digit code entered in a form elsewherein the application. You can create a text area checkpoint toconfirm that the number displayed on the button is the sameas the number entered in the form.

Page 48: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 48/95

Page 49: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 49/95

 

Accessibility Checkpoint

Identifies areas of your Web site that may not conform to theWorld Wide Web Consortium (W3C) Web ContentAccessibility Guidelines.

For example, guideline 1.1 of the W3C Web

Content Accessibility Guidelines requires you to provide atext equivalent for every non-text element. You can add anAlt property check to check whether objects that require theAlt property under this guideline, do in fact have this tag.

Page 50: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 50/95

 

XML Checkpoint

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

Page 51: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 51/95

 

Use a Regular Expression

• A regular expression is a string that specifies a complex searchphrase. 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 literalcharacter. Generally, you will answer No.

Page 52: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 52/95

 

Some Regular Expressions

Matches exactly four digits\d{4}

Matches any digit\dDigit

Matches a range of charactersMatches a range of numbers

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

Brackets

Matches one to any number of occurrences of the precedingcharacter

+Plus

Matches zero to any number of occurrences of the precedingCharacter

*Asterisk 

Matches any single character.PeriodDescriptionCharacterExpression

Page 53: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 53/95

 

Add a Comment

•  The default QuickTest Professional Keyword View does not showthe Comment field.

• Add the comment field by right-clicking on the harder field of thekeyword view.

 The list shows displayed fields with a check mark next to them;add the comment field from here.

Page 54: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 54/95

 

6. Parameters

Objectives

• Describe and use multiple parameter types.

• Drive data in multiple iterations.

• Analyze errors during iterations.• Parameterize a checkpoint.

Page 55: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 55/95

 

Data Table Parameters

• Input Parameter - allows you to run a test using different setsof data input values.

• Output Parameter - allows you to use output to capture valuesfrom the application at runtime.

When you use a data table parameter, you must instructQuickTest on where the input data will come form.

• Other Parameter Types

• Random Number – a system generated number inserted intothe parameter field during a test run.

• Environment – a variable describing a software or hardwareobject in the AUT environment. For example: the OS version orlocal host name.

• Component – a parameter type that is used while implementingbusiness process testing (BPT).

Input Parameters For Data

Page 56: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 56/95

 

Input Parameters For Datadriven Tests

• Input Parameters For Data Driven Tests

• A data-driven test is one that runs a set of user actions withmultiple input values. Data driving allows one script to testapplication functionality with many sets of data.

• Automated data driven testing frees you to perform more tests,thus increasing test coverage. Speed, repeatability, freeresources to do other kinds of quality control.

Page 57: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 57/95

 

Input Parameter

• Input Parameters allow you to replace a static, recorded value ina step with a dynamic placeholder (parameter), which representsan expandable range of values.

• Input parameter names and their values are located in

QuickTest’s Data Table.

Steps to Create An Input

Page 58: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 58/95

 

Steps to Create An InputParameter

  To create an input data table parameter:

• Select the step in the Keyword View that contains the recordedinput value.

• From the Value column, click on the current value.

• Click on the parameterize button.•

Page 59: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 59/95

 

Set the Parameter Value

• In the VALUE CONFIGURATION OPTIONS dialog, select theParameter radio button and ensure that Data Table is selectedfrom the drop-down list.

• From the Name drop down list, enter a unique column name tocreate a new column in your data table or choose an existingcolumn name from the data table.

• Use the default Global data sheet to store values.

Page 60: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 60/95

 

Supply Data to the Parameter

•  The design-time table is the central location for storing inputparameter values.

• The number of rows in the data table will cause the samenumber of test execution iterations to be run.

• As a default, the design-time data table is displayed at thebottom of the QuickTest screen.

Page 61: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 61/95

 

Verify The Test Run

• View the Test Results window to verify that each of the rows fromthe Design Time Data Table was used during the test run.

• Expand the tree for each iteration (Row#) to view specificinformation about the execution of the specific row.

Page 62: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 62/95

 

 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: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 63/95

 

Set the Number of Iterations

• Set the number of rows that will be driven into the test for thespecified field in the Run

• Setting dialog box.• The possibilities are:

• - Run one iteration

• - Run all rows

- Run a range of rows

Page 64: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 64/95

 

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 anoutput value.

• You can subsequently use this output value variable in your test.

We call this data correlation. This enables you to use dataretrieved during other parts of a test.

Steps to Create an Output

Page 65: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 65/95

 

Steps to Create an OutputParameter

In the Keyword View, choose a step that contains the field whosevalue will be output.

• In the Active Screen, right-click on the field whose value youwant to output.

• Choose Insert Output Value from the list.

• Verify the object you want to output by clicking OK in the Object

Page 66: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 66/95

 

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

• Decide whether the output step should be placed before or after

Page 67: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 67/95

 

Re-Use Outputs As Inputs

• Once an output parameter has been created, its value canbe used in the

• subsequent steps of the test

Page 68: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 68/95

 

Parameterize a Checkpoint

•  You can use parameterized expected values to make yourcheckpoints dynamic. They Can be set on:

• An object property in the Object Repository.

A checkpoint on a parameterized field.

Random Number – Input

Page 69: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 69/95

 

Random Number InputParameter

• Random Number – QuickTest can generate random numbers andinput them as values for a parameter.By default, the randomnumber ranges between 0-100

• A different random number is generated each time theparameter is called, for each iteration or for each test run.

•  You can modify these settings in the Parameter Options dialog

box.

Page 70: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 70/95

 

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 variableremains the same, regardless of the number of iterationperformed, unless you reset the value of the variable in yourscript.

Page 71: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 71/95

 

 Types of Environment Variables

User – Defined Internal• User – Defined External

• Built – In

Page 72: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 72/95

 

User Defined Dialog Box

• When a user-defined environment is set, the dialog box presentsa list of both internal and

• external with the associated values.

Page 73: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 73/95

 

Built-In Dialog Box

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

7. Reusable and Multiple

Page 74: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 74/95

 

7. Reusable and MultipleActions

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

Page 75: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 75/95

 

 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: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 76/95

 

A Test with Multiple Actions

• Actions can be divided into logical sections, like the mainsections of a transaction, or by specific business processes.

• When you create a new test, it contains one action. By dividingyour tests into multiple actions, you can design more modular

and efficient tests.

Page 77: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 77/95

 

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. TheInsert New Action window appears.

• Or use the “lego” icon on the toolbar to insert new action.

Page 78: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 78/95

 

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 comefrom the Data Table.

• Be aware of any data dependencies that occur within the

business process.

Page 79: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 79/95

 

Data Table Sheets - Global

  The Global Data Sheet:

• Enables you to create a new column or select an existing columnin the Global sheet of the Data Table.

• Inserts or outputs a value from or to current row of the globaldata sheet during each global iteration at run-time.

• Provides a source of values that can be seen and used by anyaction.

Page 80: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 80/95

 

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 anyother called actions.

• You will need to link arameters in the “main callin test”

Page 81: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 81/95

 

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: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 82/95

 

One Action used Many Times

• Rather than recording the login process three times in threeseparate tests, and enhancing this part of the script (withcheckpoints and parameterization) separately for each test, youcan 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. Itonly needs to be updated one time, in the original action.

Page 83: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 83/95

 

Set Actions as Reusable

• Create a reusable action from the Action properties dialog.

• Check the checkbox and click OK. A message will appear statinga description of a reusable action.

Page 84: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 84/95

 

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

Page 85: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 85/95

 

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 themexcept 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 youcannot insert calls to non-reusable actions.

Page 86: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 86/95

 

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

• Data from the external action’s data sheet can be imported as alocal, editable copy or kept as read only. If read-only, the datacan only be modified from the original test.

• After a reusable action is called, you will see the parameters

Page 87: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 87/95

 

Action Run Settings

• Since there are two (or more) tests running, one right afteranother, you may need to specify the iteration for eachseparately.

•  To affect the run settings for a particular action, set them in theAction Call Properties dialog box.

Right-Click on the Action label in the Keyword View, and chooseAction Call Pro erties from the list rovided.

Page 88: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 88/95

Passing Values to a Called

Page 89: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 89/95

 

Action

•  You can also define input and output parameters to be used bythe action.

•  These settings apply each time the action is called.

Page 90: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 90/95

 

Using an Action Parameter

• Once parameters have been set in Action Properties, you can tellQuickTest that the parameter type being used is an ActionParameter.

Page 91: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 91/95

 

 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 reusableor external action.

•  The test flow appears when a test is recognized as having called

actions in your test.

i

Page 92: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 92/95

 

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

l i l bl i

Page 93: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 93/95

 

Multiple Reusable Actions

When using multiple, reusable actions, keep the following inmind:

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

Page 94: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 94/95

Page 95: Tutorial on QTP 8.0

8/14/2019 Tutorial on QTP 8.0

http://slidepdf.com/reader/full/tutorial-on-qtp-80 95/95

 Thank You