Pages

Friday, March 13, 2009

Reading the data from excel sheet in QTP

There is two methods are there to retrieve data from excel sheet.

1st method:
datatable.importsheet "path of the excel file.xls",source sheetID,desination sheetID
n = datatable.getsheet("desination sheetname").getrowcount
for i = 1 to n
columnname = datatable.getsheet("destination sheetname").getparameter(i).name
if colunmname = knowncolumnname then
value = datatable.getsheet(destinationsheetname).getparameter(i)
end if
next

2nd method:
set objexcel = createobject("excel.application")
Set objWorkbook = objExcel.WorkBooks.Open("path of the file.xls")
Set objDriverSheet = objWorkbook.Worksheets("name of the sheet")
columncount = objDriverSheet.usedrange.columns.count
rowcount = objDriverSheet.usedrange.rows.count
for i = 1 to colunmcount
columnname = objDriversheet.cells(i,1)
if columnname = knowncolumnname
then
for j = 1 to rowcount
fieldvalue = objdriversheet.cells(j,i)
next
end if
next

Monday, March 2, 2009

Framework

A test automation framework is a set of assumptions, concepts, and practices that provide support for automated software testing

Benefits for Framework:

• Allow highest possible reusability
• Support different application versions
• Should support different environments
• Self Configurable
• Easy to use and understand
• Flexible

General types of framework:
• The Test Script Modularity Framework
• The Test Library Architecture Framework
• The Keyword Driven Testing Framework
• The Data Driven Testing Framework
• The Hybrid Test Automation Framework

Test script Modularity Frame work:
The test script modularity framework requires the creation of small, independent scripts that represent modules of the application-under-test. These small scripts are then used in a hierarchical fashion to construct larger tests, realizing a particular test case.

The Test Library Architecture Framework
The test library architecture framework is very similar to the test script modularity framework but it divides the application-under-test into procedures and functions instead of scripts. This framework requires the creation of library files that represent modules, sections, and functions of the application-under-test. These library files are then called directly from the test case script.

The Keyword Driven Testing Framework
Keyword-driven testing framework requires the development of data tables and keywords, independent of the test automation tool used to execute them and the test script code that "drives" the application-under-test and the data. Keyword-driven tests look very similar to manual test cases. In a keyword-driven test, the functionality of the application-under-test is documented in a table as well as in step-by-step instructions for each test. It is an application independent automation framework.

The Data Driven Testing Framework
Data-driven testing is a framework where test input and output values are read from data files (datapools, ODBC sources, cvs files, Excel files, DAO objects, ADO objects, and such) are loaded into variables in captured or manually coded scripts. In this framework, variables are used for both input values and output verification values. Navigation through the program, reading of the data files, and logging of test status and information are all coded in the test script.

The Hybrid framework:
“Hybrid” frame work, where we use Data driven framework and Key word Driven Frame work.

Thursday, February 26, 2009

QTP - Familiarizing with recording process

we will test with the mercury sample application FLIGHT.

QTP script consists of things like actions, functions etc. In QTP 9 we can place 120 actions in a script, this is a limit.

1) First of all click on Record toolbar button (or Automation menu --> Record or press F3). When we click on Record, "Record and Run Settings" window opens up. Go to "Windows Applications" tab and choose first option "Record and run test on any open windows based application." and click on ok.

2) Open Flight application (Start -->All programs -->Quick Test Professional --> Sample Applications --> Flight)

3) Type Agent name as "Kumar" (You can enter any, but must be 4 characters or more) and enter password as "mercury".

4) In the flight reservation window that opens up:

A. In the Flight Schedule area, in Date of Flight enter tomorrow's date in mm/dd/yyyy format.( I used tabs to move to next fields)
B. In Fly From enter Denver
In Fly To enter London
C. Click on Flights button which is on the right hand side of "Fly To".
D. Let the default option be selected in the Flights Table.
E. Click ok
F. In the name field enter your name. It will fill rest of the required information by itself.
G. Click on insert order and after the order is inserted
H. Click on File --> exit.


5) Now you have recorded your first script. You can click on the expert view tab to see the script which QTP has recorded for you automatically.

6) Click on run from Automation Menu (or press F5) to open up run dialog box.

7) Go to the "Results Location" tab, and below "write run results to", in "new run results folder" radio button- let it be the default option --C:\Program Files\Mercury Interactive\QuickTest Professional\Tests\Test1\Res1(you can also change it)