QTP

24
Q. 1: Tell me briefly about QTP? If you are going for a position related to QTP, you could expect this as the first question in the interview. The first step on the part of an interviewer is to make you comfortable with a basic question. Hence try to remember maximum portion from the following content that should be presented to the interviewer if situation arises. QTP is a graphical interface record-playback automation tool. It is able to work with any web, Java or windows client application. QTP enables you to test standard web objects and ActiveX controls. In addition to these environments, QTP also enables you to test Java applets and applications and multimedia objects on Applications as well as standard Windows applications, Visual Basic applications and .NET framework applications... QTP is Mercury Interactive Functional Testing Tool. Mercury QTP provides the industry's best solution for functional test and regression test automation - addressing every major software application and environment. This next-generation automated testing solution deploys the concept of Keyword-driven testing to radically simplify test creation and maintenance. Unique to QTP’s Keyword-driven approach, test automation experts have full access to the underlying test and object properties, via an integrated scripting and debugging environment that is round-trip synchronized with the Keyword View. QTP enables you to test standard Windows applications, Web objects, ActiveX controls, and Visual Basic applications. You can also acquire additional QTP 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). <<<<<< =================== >>>>>> Q. 2: What’s the basic concept of QTP? QTP is based on two concepts like: a) Recording b) Playback 1

description

QTP

Transcript of QTP

Page 1: QTP

Q. 1: Tell me briefly about QTP?

If you are going for a position related to QTP, you could expect this as the first question in the interview.

The first step on the part of an interviewer is to make you comfortable with a basic question. 

Hence try to remember maximum portion from the following content that should be presented to

the interviewer if situation arises.

QTP is a graphical interface record-playback automation tool. It is able to work with any web, Java or

windows client application. QTP enables you to test standard web objects and ActiveX controls. In

addition to these environments, QTP also enables you to test Java applets and applications and

multimedia objects on Applications as well as standard Windows applications, Visual Basic applications

and .NET framework applications...

QTP is Mercury Interactive Functional Testing Tool.

Mercury QTP provides the industry's best solution for functional test and regression test automation -

addressing every major software application and environment. This next-generation automated testing

solution deploys the concept of Keyword-driven testing to radically simplify test creation and maintenance.

Unique to QTP’s Keyword-driven approach, test automation experts have full access to the underlying

test and object properties, via an integrated scripting and debugging environment that is round-trip

synchronized with the Keyword View.

QTP enables you to test standard Windows applications, Web objects, ActiveX controls, and Visual Basic

applications. You can also acquire additional QTP 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).

<<<<<< =================== >>>>>>

Q. 2: What’s the basic concept of QTP?

QTP is based on two concepts like:

a) Recording

b) Playback

<<<<<< =================== >>>>>>

Q. 3: Which scripting language used by QTP?

QTP uses VB scripting.

1

Page 2: QTP

<<<<<< =================== >>>>>>

Q. 4: How many types of recording facility are available in QTP?

QTP provides three types of recording methods like:

a) Context Recording (Normal)

b) Analog Recording

c) Low Level Recording

<<<<<< =================== >>>>>>

Q. 5: How many types of Parameters are available in QTP?

QTP provides three types of Parameters like:

a) Method Argument

b) Data Driven

c) Dynamic

<<<<<< =================== >>>>>>

Q. 6: What’s the testing process in QTP?

QTP testing process consist of seven steps like:

1) Preparing to recording

2) Recording

3) Enhancing your script

4) Debugging

5) Run

6) Analyze

7) Report Defects etc.

<<<<<< =================== >>>>>>

Q. 7: How to Start recording using QTP?

Choose Test > Record or click the Record button.

2

Page 3: QTP

When the Record and Run Settings dialog box opens, to do this;

1) In the Web tab, select Open the following browser when a record or run session begins.

2) In the Windows Applications tab, confirm that Record and run on these applications (opened on

session start) is selected, and that there are no applications listed.

<<<<<< =================== >>>>>>

Q. 8: How to insert checkpoints to an image to check enable property in QTP?

Answer - 1: If all images are like push button than you can check the property enabled or disabled. 

If you are not able to find that property than go to object repository for that object and click on add remove

to add the available properties to that object. 

And if you take it as image than you need to check visible or invisible property, there are no enable or

disable properties for the image object.

Answer - 2: The Image Checkpoint does not have any property to verify the enable/disable property.

Important aspects that needs to be checked are:

a) Find out form the Developer if he is showing different images for activating/deactivating i.e. grayed out

image. That is the only way a developer can show deactivate/activate if he is using an "image". Else he

might be using a button having a headsup with an image.

b) If it is a button used to display with the headsup as an image you would need to use the object

Properties as a checkpoint.

<<<<<< =================== >>>>>>

Q. 9: How to save your test using QTP?

Select File > Save or click the Save button.

The Save dialog box opens to the Tests folder.

Create a folder which you want to save to, select it, and click Open.

Type your test name in the File name field.

Confirm that Save Active Screen files is selected.

3

Page 4: QTP

Click Save.

Your test name is displayed in the title bar of the main QTP window.

<<<<<< =================== >>>>>>

Q. 10: How to Run a Test using QTP?

Step-1: Start QTP and open your test.

If QTP is not already open, choose Start > Programs > QuickTest Professional > QuickTest Professional.

# If the Welcome window opens, click Open Existing.

# If QTP opens without displaying the Welcome window, choose File > Open or click the Open button.

In the Open Test dialog box, locate and select your test, then click Open.

Step-2: Confirm that all images are saved to the test results.

QTP allows you to determine when to save images to the test results.

Choose Tools > Options and select the Run tab. In the Save step screen capture to test results option,

select Always.

Click OK to close the Options dialog box.

Step-3: Start running your test.

Click Run or choose Test > Run. The Run dialog box opens.

Select New run results folder. 

Accept the default results folder name.

Click OK to close the Run dialog box. 

Q. 12: How to do load testing for web based Application?

1) Recording a scenario in QTP of web based application.

2) Make 100 copies of that scenario and run the test (scenario run for 100 times)

4

Page 5: QTP

3) In that case, do the load of application on server.

4) The basic logic of running the copy 100 times is to create same scenario as if 100 users were working.

Q. 13: What is the extension of script and object repository files?

Object Repository : .tsr , Script : .mts, Excel : Default.xls

16: What's the role of Checkpoints in QTP?

A checkpoint verifies that expected information is displayed in your application while the test is running.

Checkpoint is basically a point in the test, which validates for truthfulness of a specific thing in the AUT.

There are different types of checkpoints depending on the type of data that needs to be tested in the AUT.

It can be text, image/bitmap, attributes, XML etc....

<<<<<< =================== >>>>>>

Q. 17: What types of checkpoints are offered by QTP?

There are 10 types of checkpoints you can insert in QTP:

1) Standard Checkpoint checks the property value of an object in your application or Web page. The

standard checkpoint checks a variety of objects such as buttons, radio buttons, combo boxes, lists, etc.

2) Image Checkpoint checks the value of an image in your application or Web page. For example, you

can check that a selected image’s source file is correct.

3) Bitmap Checkpoint checks an area of your Web page or application as a bitmap.

4) Table Checkpoint checks information within a table. For example, suppose your application or Web

site contains a table listing all available flights from one place to another. You can add a table checkpoint

to check that the time of the first flight in the table is correct.

5) Text Checkpoint checks that a text string is displayed in the appropriate place in your application or

on a Web page.

6) Text Area Checkpoint checks that a text string is displayed within a defined area in a Windows

application, according to specified criteria.

7) Accessibility Checkpoint identifies areas of your Web site that may not conform to the World Wide

Web Consortium (W3C) Web Content Accessibility Guidelines.

5

Page 6: QTP

8) Page Checkpoint checks the characteristics of a Web page. For example, you can check how long a

Web page takes to load or whether a Web page contains broken links.

9) Database Checkpoint checks the contents of a database accessed by your application.

10) XML Checkpoint checks the data content of XML documents in XML files or XML documents in Web

pages and frames.

<<<<<< =================== >>>>>>

Q. 18: How to add a standard checkpoint in your test?

1) Start QTP and open your test.

In the Open Test dialog box, locate and select your test, then click Open.

2) Save the test as Checkpoint.

Select File > Save As. Save the test as Checkpoint.

3) Confirm that the Active Screen option is enabled.

If you do not see the Active Screen at the bottom of the QTP window, click the Active Screen button, or

choose View > Active Screen.

4) Locate the page where you want to add a standard checkpoint.

5) Create a standard checkpoint.

In the Active Screen, right-click element in your application and choose Insert Standard Checkpoint.

6) Save the test.

<<<<<< =================== >>>>>>

Q. 19: How to add a page checkpoint to your test?

The page checkpoint checks that the number of links and images in the page when you run your test is

the same as when you recorded your test.

1) Locate the page where you want to add a page checkpoint.

2) Create a page checkpoint.

6

Page 7: QTP

Right-click anywhere in the Active Screen, and choose Insert Standard Checkpoint. 

The Object Selection - Checkpoint Properties dialog box opens. 

Note that this dialog box may include different elements, depending on where you click in the Active

Screen.

3) Save the test.

<<<<<< =================== >>>>>>

Q. 20: How run time data (Parameterization) is handled in QTP?

You can enter test data into the Data Table, an integrated spreadsheet with the full functionality of Excel,

to manipulate data sets and create multiple test iterations, without programming, to expand test case

coverage.

Data can be typed in or imported from databases, spreadsheets, or text files. 

21: What is keyword view and Expert view in QTP?

By QTP’s Keyword Driven approach, the test automation experts have full access to the underlying test

and object properties, via an integrated scripting and debugging environment that is round-trip

synchronized with the Keyword View.

Advanced testers can view and edit their tests in the Expert View, which reveals the underlying industry-

standard VBScript that QTP automatically generates.

Any changes made in the Expert View are automatically synchronized with the Keyword View.

<<<<<< =================== >>>>>>

Q. 22: How QTP recognizes Objects in AUT?

QTP stores the definitions for application objects in a file called the Object Repository.

As you record your test, QTP will add an entry for each item you interact with.

Each Object Repository entry will be identified by a logical name (determined automatically by QTP), and

will contain a set of properties (type, name, etc) that uniquely identify each object.

Each line in the QTP script will contain a reference to the object that you interacted with, a call to the

appropriate method (set, click, check) and any parameters for that method (such as the value for a call to

7

Page 8: QTP

the set method). 

The references to objects in the script will all be identified by the logical name, rather than any physical,

descriptive properties.

<<<<<< =================== >>>>>>

Q. 23: What are the types of Object Repositories in QTP?

QTP has two types of object repositories for storing object information: 

1) Shared object repositories and 

2) Action object repositories. 

You can choose which type of object repository you want to use as the default type for new tests, and you

can change the default as necessary for each new test. 

The object repository per-action mode is the default setting. In this mode, QTP automatically creates an

object repository file for each action in your test so that you can create and run tests without creating,

choosing, or modifying object repository files. 

However, if you modify values in an action object repository, your changes do not have any effect on

other actions. Hence, if the same test object exists in more than one action and if you modify an object's

property values in one action, you may need to make the same change in every action (and any test)

containing the object.

<<<<<< =================== >>>>>>

Q. 24: If I give some thousand tests to execute in 2 days what do you do?

Adhoc testing is done. It covers the least basic functionality to verify that the system is working fine.

 26: Explain the Test Fusion Report of QTP?

Once a tester has run a test, a TestFusion report displays all aspects of the test run. This is a high-level

results overview, an expandable Tree View of the test specifying the following:

# Exactly where application failures occurred,

8

Page 9: QTP

# Test data used

# Application screen shots for every step that highlight any discrepancies

# Detailed explanations of each checkpoint pass and failure.

By combining TestFusion reports with QTP, you can share reports across an entire QA and development

team.

<<<<<< =================== >>>>>>

Q. 27: QTP supports which environments?

QTP supports functional testing of all enterprise environments, including Windows, Web, ..NET,

Java/J2EE, SAP, Siebel, Oracle, PeopleSoft, Visual Basic, ActiveX, mainframe terminal emulators, and

Web services.

32: How do you check Bitmaps?

You can check an area of a Web page or application as a bitmap. While creating a test or component,

you specify the area you want to check by selecting an object. You can check an entire object or any area

within an object. QTP captures the specified object as a bitmap, and inserts a checkpoint in the test or

component. You can also choose to save only the selected area of the object with your test or component

in order to save disk space.

When you run the test or component, QTP compares the object or selected area of the object currently

displayed on the Web page or application with the bitmap stored when the test or component was

recorded. If there are differences, QTP captures a bitmap of the actual object and displays it with the

expected bitmap in the details portion of the Test Results window. By comparing the two bitmaps

(expected and actual), you can identify the nature of the discrepancy. For more information on test results

of a checkpoint, see Viewing Checkpoint Results.

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.

You can create bitmap checkpoints for all supported testing environments (as long as the appropriate

add-ins are loaded). 

The results of bitmap checkpoints may be affected by factors such as operating system, screen

resolution, and color settings.

34: What are the Features & Benefits of QTP?

9

Page 10: QTP

1) Key word driven testing

2) Suitable for both client server and web based application

3) VB script as the script language

4) Better error-handling mechanism

5) Excellent data driven testing features

6) Operates stand-alone, or integrated into HP Business Process Testing and HP Quality Center. 

It introduces next-generation zero-configuration Keyword Driven testing technology in QTP allowing for

fast test creation, easier maintenance, and more powerful data-driving capability. 

It identifies objects with Unique Smart Object Recognition, even if they change from build to build,

enabling reliable unattended script execution. 

It collapses test documentation and test creation to a single step with Auto-documentation technology. 

It enables thorough validation of applications through a full complement of checkpoints.

<<<<<< =================== >>>>>>

Q. 35: How to handle the exceptions using recovery scenario manager in QTP?

You can instruct QTP to recover unexpected events or errors that occurred in your testing environment

during test run. Recovery scenario manager provides a wizard that guides you through the defining

recovery scenario. 

Recovery scenario has three steps

1) Triggered Events

2) Recovery steps

3) Post Recovery Test-Run

37: Why do we use Regular Expressions?

We create a text checkpoint for searching a specific text string. We can use regular expressions to

increase the flexibility and adaptability of your tests.

10

Page 11: QTP

Regular expressions enable QTP to identify objects and text strings with varying values. 

You can use regular expressions when defining the properties of an object, the methods of an argument,

when parameterizing a step, and when creating checkpoints with varying values.

<<<<<< =================== >>>>>>

Q. 38: Explain QTP Testing process ?

The QTP testing process consists of 6 main phases:

1) Create your test plan: Prior to automating there should be a detailed description of the test including

the exact steps to follow, data to be input, and all items to be verified by the test. The verification

information should include both data validations and existence or state verifications of objects in the

application.

2) Recording a session on your application: As you navigate through your application, QTP graphically

displays each step you perform in the form of a collapsible icon-based test tree. A step is any user action

that causes or makes a change in your site, such as clicking a link or image, or entering data in a form.

3) Enhancing your test:

# Inserting checkpoints into your test lets you search for a specific value of a page, object or text string,

which helps you identify whether or not your application is functioning correctly.

Checkpoints can be added to a test as you record it or after the fact via the Active Screen. It is much

easier and faster to add the checkpoints during the recording process.

# Broadening the scope of your test by replacing fixed values with parameters lets you check how your

application performs the same operations with multiple sets of data.

# Adding logic and conditional statements to your test enables you to add sophisticated checks to your

test.

4) Debugging your test: If changes were made to the script, you need to debug it to check that it

operates smoothly and without interruption.

5) Running your test on a new version of your application: You run a test to check the behavior of

your application. While running, QTP connects to your application and performs each step in your test.

6) Analyzing the test results: You examine the test results to pinpoint defects in your application.

11

Page 12: QTP

7) Reporting defects: As you encounter failures in the application when analyzing test results, you will

create defect reports in Defect Reporting Tool.

<<<<<< =================== >>>>>>

Q. 39: What is parameterizing of Tests?

When you test your application, you may want to check how it performs the same operations with multiple

sets of data. 

For example, you want to check how your application responds to ten separate sets of data. You could

record ten separate tests, each with its own set of data. 

Alternatively, you can create a parameterized test that runs ten times: each time the test runs, it uses a

different set of data.

42: Briefly tell me about the checkpoints in QTP?

A checkpoint verifies that expected information is displayed in an application while the test is running. You

can add eight types of checkpoints to your test for standard web objects using QTP.

1) A page checkpoint checks the characteristics of an application

2) A text checkpoint checks that a text string is displayed in the appropriate place on an application 

3) An object checkpoint (Standard) checks the values of an object on an application

4) An image checkpoint checks the values of an image on an application

5) A table checkpoint checks information within a table on an application 

6) An Accessibility checkpoint checks the web page for statutory compliance.

7) An XML checkpoint checks the contents of individual XML data files or XML documents that are part of

your Web application.

8) A database checkpoint checks the contents of databases accessed by your web site

<<<<<< =================== >>>>>>

Q. 43: In how many ways we can add checkpoints to an application using QTP?

12

Page 13: QTP

We can add checkpoints while recording the application or we can add after recording is completed using

Active screen 

To perform the second one The Active screen must be enabled while recording

Briefly explain the QTP Environment.

QTP environment uses the graphical interface and ActiveScreen technologies - A testing process for

creating test scripts, relating manual test requirements to automated verification features - Data driving to

use several sets of data using one test script.

<<<<<< =================== >>>>>>

Q. 46: Explain the concept as to how QTP identifies object.

During recording QTP looks at the object and stores it as test object. 

For each test object QTP learns a set of default properties called mandatory properties, and look at the

rest of the objects to check whether this properties are enough to uniquely identify the object. 

During test run, QTP searches for the run time objects that matches with the test object it learned while

recording.

<<<<<< =================== >>>>>>

Q. 47: Explain the Object Repositories types, Which & when to use?

Deciding Which Object Repository Mode to Choose

To choose the default object repository mode and the appropriate object repository mode for each test,

you need to understand the differences between the two modes.

In general, the object repository per-action mode is easiest to use when you are creating simple record

and run tests, especially under the following conditions:

You have only one, or very few, tests that correspond to a given application, interface, or set of objects.

You do not expect to frequently modify test object properties.

You generally create single-action tests.

Conversely, the shared object repository mode is generally the preferred mode when:

13

Page 14: QTP

You have several tests that test elements of the same application, interface, or set of objects.

You expect the object properties in your application to change from time to time and/or you regularly need

to update or modify test object properties.

You often work with multi-action tests and regularly use the Insert Copy of Action and Insert Call to Action

options.

<<<<<< =================== >>>>>>

Q. 48: Can we script any test case with out having Object repository? Or Using Object Repository

is a must?

No. You can script with out Object repository by knowing the Window Handlers, spying and recognizing

the objects logical names and properties available.

What is Object Spy in QTP?

Using the Object Spy, you can view the properties of any object in an open application. 

You use the Object Spy pointer to point to an object. 

The Object Spy displays the selected object’s hierarchy tree and its properties and values in the

Properties tab of the Object Spy dialog box.

 In how many ways we can parameterize data in QTP?

There are four types of parameters:

a) Test, action or component parameters - enable you to use values passed from your test or

component, or values from other actions in your test.

b) Data Table parameters - enable you to create a data-driven test (or action) that runs several times

using the data you supply. In each repetition, or iteration, QTP uses a different value from the Data Table.

c) Environment variable parameters - enable you to use variable values from other sources during the

run session. These may be values you supply, or values that QTP generates for you based on conditions

and options you choose.

14

Page 15: QTP

d) Random number parameters: enable you to insert random numbers as values in your test or

component. For example, to check how your application handles small and large ticket orders, you can

have QTP generate a random number and insert it in a number of tickets edit field.

How to use the Object spy in QTP?

There are two ways to Spy the objects in QTP

1) Through file toolbar: In the File toolbar click on the last toolbar button (an icon showing a person with

hat).

2) Through Object repository Dialog: In Object repository dialog click on the button"object spy..."

In the Object spy Dialog click on the button showing hand symbol. the pointer now changes in to a hand

symbol and we have to point out the object to spy the state of the object if at all the object is not visible.

or

When window is minimized then Hold the Ctrl button and activate the required window to and release the

Ctrl button.

 What is the file extension of the code file & object repository file in QTP?

File extension are:

# Per test object rep :- filename.mtr

# Shared Oject rep :- filename.tsr

# Code file extension id script.mts

 How do we draw a brief comparison of WinRunner & QTP?

Environments QTP Only:

ERP/CRM SAP

  Siebel 7.x

  PeopleSoft 8.x

.Net WinForms

15

Page 16: QTP

  WebForms

  .Net controls

Web Services XML, HTTP

  WSDL, SOAP

  J2EE, .Net

Multimedia RealAudio/Video

  Flash

 74: How many types of Actions are there in QTP?

There are three kinds of actions:

1) Non-reusable action: an action that can be called only in the test with which it is stored, and can be

called only once. 

2) Reusable action: an action that can be called multiple times by the test with which it is stored (the

local test) as well as by other tests.

3) External action: a reusable action stored with another test. External actions are read-only in the

calling test, but you can choose to use a local, editable copy of the Data Table information for the external

action.

 76: How do we handle Run-time errors?

On Error Resume Next: causes execution to continue with the statement immediately following the

statement that caused the run-time error, or with the statement immediately following the most recent call

out of the procedure containing the "On Error Resume Next" statement. 

This allows execution to continue despite a run-time error. 

You can then build the error-handling routine inline within the procedure.

Using "Err" object msgbox "Error no: " & " " & Err.Number & " " & Err.description & " " & Err.Source &

Err.HelpContext

<<<<<< =================== >>>>>>

16

Page 17: QTP

Q. 77: What are the different scripting languages you could use when working with QTP ?

Visual Basic (VB),XML, JavaScript, Java, HTML

<<<<<< =================== >>>>>>

Q. 78: How to handle dynamic objects in QTP?

QTP has a unique feature called Smart Object Identification/recognition. QTP generally identifies an

object by matching its test object and run time object properties. QTP may fail to recognize the dynamic

objects whose properties change during run time. Hence it has an option of enabling Smart Identification,

wherein it can identify the objects even if their properties changes during run time.

Check this out - If QTP is unable to find any object that matches the recorded object description, or if it

finds more than one object that fits the description, then QTP ignores the recorded description, and uses

the Smart Identification mechanism to try to identify the object. While the Smart Identification mechanism

is more complex, it is more flexible, and thus, if configured logically, a Smart Identification definition can

probably help QTP identify an object, if it is present, even when the recorded description fails.

The Smart Identification mechanism uses two types of properties:

Base filter properties: The most fundamental properties of a particular test object class; those whose

values cannot be changed without changing the essence of the original object. 

For example, if a Web link's tag was changed from to any other value, you could no longer call it the

same object. 

Optional filter properties: Other properties that can help identify objects of a particular class as they are

unlikely to change on a regular basis, but which can be ignored if they are no longer applicable.

How to do we do the scripting? Is there any inbuilt functions in QTP as in QTP-S? What is the

difference between them? How to handle script issues?

Yes, there's an in-built functionality called "Step Generator" 

in Insert->Step->Step Generator -F7, which will generate the scripts as u enter the appropriate steps.

Can you quickly tell me the Differences between QTP and Winrunner?

a) QTP is object bases Scripting (VBS) where Winrunner is TSL (C based) Scripting.

b) QTP supports ".NET" application Automation not available in Winrunner

17

Page 18: QTP

c) QTP has "Active Screen" support, which captures the application, not available in WR.

d) QTP has "Data Table" to store script values, variables which WR does not have.

e) Using a "point and click" capability you can easily interface with objects, their definitions and create

checkpoints after having recorded a script – without having to navigate back to that location in your

application like you have to with WinRunner. This greatly speeds up script development.

Typical Architecture of Automation Frameworks

An Automation Framework primarily comprises of elements like:

A) Function Library

B) Object Repository

C) Database

D) Application Scenario Files

E) Initialization VB Script

F) Sequence File

G) Driver Script

H) Test Case List File

A)FunctionLibrary:

While creating automation framework the entire coding is done by using VB script functions

that are user defined. We store these VB script functions in function library files with (*.vbs)

extension. Apart from Driver Scripts, there is no need of doing any script creation beyond

the function library.

Every application consists of following two types of function libraries

1) Containing common functions that are not dependent on the application functions.

2) Containing functions, which are specific, the application.

The script designer strives to utilize the common functions, which are independent of the

application, to the maximum possible extent. However there is no hard & fast rule to always

use common functions only. Whenever there is absolute necessity of using some functions,

which are essential for the application, the same are created on the spot & are stored in the

concerned function library.

"ExecuteScenarioFile" is a function present in our common function library & is called from

the Driver Script or from outside the function library. This function is used for accessing the

keywords, various objects and all other parameters from the Scenario File. This is also used

18

Page 19: QTP

to call other relevant functions as well from the function library. 

The function library files with (*.vbs) extension are stored in the Function Library folder.

B)ObjectRepository:

Every application being automated contains a single / unique object repository file. The

object repository files with (*.tsr) extension are stored in the Object Repository folder. 

C)Database:

MS Access database module of MS Office is used to store all the test data. While designing

the structure of the database the designer tries to keep one independent table for every

screen of the application. Test Case ID field is usually designated as the primary key for

every table. Test Case ID is unique for every record used by the program for iteration. Test

Case ID identifier is quite helpful in navigating through some particular type of data stored in

the table. QTP establishes a link with database by building its system DSN and using the

same DSN in the script. As a best practice, every application should have an independent

database file; however for the sake of conserving the space on the hard disc, multiple

applications can share the same database. 

The MS Access database files with (*.mdb) extension are stored in the Database folder.

D)ApplicationScenarioFiles:

This is a typical MS Excel spreadsheet file, which contains records with information on

different keywords, objects & many other parameters representing a test scenario. QTP

accesses the information from this application scenario file & performs the defined actions

over the application. The MS Excel spreadsheet file serves the purpose of test case

documentation as well & there remains no need to create another set of test case

documentation. The application scenario files are the most versatile features of keyword

driven framework.

The subject matter experts (SME’s) who usually don’t have much of programming

knowledge are able to easily use these application scenario files for creating automated

tests by making quick selection of keywords from the dropdown lists.

We can save tremendous amount of automation effort by creating maximum number of

common which can be reused again & again thereby getting the maximum benefit.

The application scenario files with (*.xls) extension are stored in the application folder

corresponding to the particular application.

E)SequenceFile:

These are initialization settings files for the Driver QTP Script and are similar to the

19

Page 20: QTP

conventional configuration files. This is also a typical MS Excel spreadsheet file, which

contains records with information like:

1) Name of Application Scenario file 2) Name of Object Repository

3) Name of Function Library

4) List of Test Cases to be executed

5) Details of Data Source

6) Details of script development work area

7) Details of script execution work area

Every application carries a "Run" or "Ignore" flag specifying the application scenario being

executed. This sequence file in the form of spreadsheet is used by the Initialization VB Script

uses & decides as to which application & which scenario is to be executed, for getting the

information on the concerned Application Scenario file & for doing the initialization settings

for the application.

The Sequence File with (*.xls) extension are stored directly in the root folder.

F)InitializationVBScript:

Initialization is the starting point for the execution of a script. QTP gets launched by

Initialization VB Script & the work area is set either as development or production depending

upon the inputs from the user. We can use the same Initialization VB script for doing the

initialization settings for multiple web applications.

It carries out the following settings for the Driver Script.

1) Setting the Work Area according to user input.

2) Setting the application scenario file for the current run.

3) Setting the object repository.

4) Setting the function libraries.

5) Setting the data source.

6) Setting the test case list.

Once the above settings are completed, Initialization VB Script launches the Driver Script in

read only mode, & makes it ready for execution by the user. Thereafter the Driver Script

takes over the entire control.

20

Page 21: QTP

The Initialization VB Script with (*.vbs) extension are stored directly under the root folder.

G)DriverScript:

These are test scripts of QTP meant for driving the script execution after Initialization VB

Scripts complete their task. These driver scripts reside outside the function library.

These Driver Scripts call the "ExecuteScenarioFile" function for accessing the keywords,

various objects and all other parameters from the Scenario File and making calls to suitable

functions in the function library.

The Driver Scripts are stored directly under the root folder.

H)TestCaseListFile:

These files contain the list of all Test Case ID’s for execution under the present run. With the

help of these files, the user gets an option for selecting only a subset of the data from the

database for executing in the present run.

These Test Case List Files are stored directly under the root folder.

21