Wednesday, November 3, 2010

Hybrid Framework in QTP

Framework is the way we design our system so that QTP can be effectively implemented on
the system. Hybrid Framework is a combination of Script modularity framework and Data Driven Framework.
Steps for creating Hybrid framework:

1) Create Actions corresponding to different functionalities or modules in which you have breaked your system e.g. so in case we classified our entire application in 8 modules then we would be creating 8 Actions to cover all the modules.

2) Create Object Repository(Shared or Local) preferable Shared by adding all the objects that would be the part of your applications to that Repository, in case there are some local objects in any particular Action then that could be the part of Local Object Repository.

3) Associate your Object Repository to all the Actions that you have created.

4) Record scripts for individual Actions and customize your scripts based on your test Cases.

5) In case certain functions are being written then those functions should be saved under folder Function Library and those functions should be then added and associated to your Actions.

6) In case any further steps are to be used like using Recovery scenario, checkpoints etc can be done.

7) For providing data to these actions or scripts or providing ability to parameterize your scripts any of the below mentioned methods could be used:
-Data Table
-Random Numbers
-Environmental Variable

Monday, November 1, 2010

QTP Queries

Some questions Related to QTP:

Q. In how many ways data can be provided to the script?

-Data can be provided to the script in below mentioned ways:

a) Data table

b) Environmental Variable

c) Random numbers

Q. How many types of data table are there and what is the difference between them?

-There are two types of Data Tables:

a) Local-Local data table is one which is associated with individual action and data from which can only be called by that action

b) Global-Global data table is one which is associated with all the actions and data from Global data table can be called from any action.

Q. Can data be copied from Global to Local Datasheet?

-Yes, Using export and import functionality this can be done.

Q. What is Ordinal Identifier in context with object properties?

-In case QTP has to identify object properties of two similar objects then it uses Ordinal Identifier to identify different properties of two objects based on:

Index

Location

Time

Q. What are different Ordinal Identifiers for Window and Web based applications?

-Default ordinal identifier for windows application is Location whereas for web applications it is creation time.

Q. What is the Folder structure that needs to be created while working on Hybrid framework?

-The folder structure would be:

a) Function Library

b) Object Repository

c) Recovery Scenario

d) Scripts

e) Test Data

f) Test Results

Q. What is the difference between Synchronization Point and Wait in QTP?

- Synchronization Point: Synchronization Point makes available specified amount of time for an object to process before moving on to next time. In case a specific web page loads QTP moves ahead in case of Synchronization E.g. Loading of a web page

Synchronization is enabled only during recording.

-Wait: Wait is like forcing QTP to wait for specified period of time. If the wait time is 10 sec and page loads in 3 sec, still the QTP waits for 7 more seconds

Q. What is Object Repository?

-Object repository stores the object properties.

Q. What is Shared and Local Object Repository?

-Shared OR (.tsr)-This is one object repository that could be shared across all the Actions and any changes made to this are available for all actions.

-Local OR (.mtr)-This is one object repository that is associated to individual Actions and cannot be shared across other actions.

Q. What is recovery Scenario in QTP?

-Recovery scenario helps QTP to recover any unexpected error that might occur during run time.

QTP can handle 4 types of exceptions:

1. Pop up

2. QTP Run error

3. Application Crash

4. Object State error

Recovery scenario will wait till the Global Synchronization time i.e. 20 sec

It has 3 main parts:

We would take an example of a pop up that appears once we try to login which asks user to whether he wants the password to be remembered or not.

A) Trigger Even-In this part we would define occurrence of this Pop up

B) Recovery Scenario –In this part we would let QTP know what it has to do when pop up appears i.e. whether to click Yes or No on that Pop up

C) Post Recover Scenario-Here we would let QTP know what has to be done once it has recovered from this scenario i.e. to repeat the current step or move to next.

Q. What are steps before actually running the scripts?

-Create the required framework

-Record the scripts

-Create the required Object Repository (OR)

-Associate you OR to Your actions

-In case any recovery scenarios are there then those have to be defined

-Insert the required checkpoints and do any customizations that are required in the recorded script

-Run the script

Q. How to create a function and call it from Script?

-Creating a function is a simple step wherein required function is created on notepad and save them as .vbs under folder Function Library

-Now on QTP File-->Settings-->Resources-->Add the file saved in function library

-Associate your function Library to your Action

-Call the Function from the Action

Q. What are different checkpoints in QTP?

-Image Checkpoint: Covered under standard Checkpoint image checkpoint checks the exact content of the image

-Bitmap Checkpoint: Compares area of the two images pixel by pixel, so there may be a case where it pass the test where there are two different images but of same size or pixel

-Table Checkpoint: Checks the content of a table, it is a part of Standard Checkpoint

-Text Checkpoint: Text checkpoints checks the exact content of the Text under consideration

-Text Area Checkpoint: Checks the exact Area of the text irrespective of the content

-Database Checkpoint: It checks whether the content entered on UI is actually inserted into database

-XML Checkpoint: Used to check contents of XML, basically used for testing web services

-Page Checkpoint: It checks properties of a web page which includes checking broken links and images; it is a part of Standard Checkpoint

-Accessibility Checkpoint: Usually done for people who are visually impared. There are some standards which needs to be included in the code which would initiate some tags so website would speak when a blind person use that mouse on website e.g. Tooltip

Q. What is the difference between Public and Private Variable?

-Public variables are those which can be used in all the Actions

-Private variables are those which can only be used in those actions

Q. What is the file extension of Function library?

-The file extension for Function library is .qfl

Q. What is the role of Object Spy?

-Object spy is used to get properties of any object

Q. What is output value in QTP and how it has been used?

-Whenever system generates some values and we have to pick that value we use Output Value.

Q. How to import data from DB into Data table?

-Flow for importing is:

Import-->Database-->Specify SQL Statement-->Create Connector-->Machine DSN-->Select -->OK-->Write Query