Pages

Tuesday, 10 July 2012

Data driven Test in QTP


Data driven Test
Data Driven:Running the test with multiple sets of data
Parameterization:It is a variable that is assigned a value fro various data sources or generator
Standard parameter types:
1.Data table
2.Environment variable
3.Random number
Advanced Parameter Types
1.Text Files
2.Excel Files
3.Database
1.Create data driven test Using data table
QTP enables you to create and run tests which are driven by data stored in table
When you test your application,you may want to check how it performs the same operations with multiples sets of data
For example
suppose you want to check how your application responds to ten seperate sets of data,you could record ten seperate tasks,each with its own set of data
Alternatively
you could create a data driven test with aloop that runs ten times
Parameterization tests
steps for parameterization
1.defining a data table parameter
2.adding parameter values to the data table
3.running and anlyzing a parameterized test
in the keyword view,click to teh value cell of teh step and then click the parameterization icon
Results
after running a test,we can view a report of major events that occured during the test run
if any iterations failed report it as defect using QC/Defect Tracking tool

Datatable Methods


Datatable Methods




Datatable Methods are used for performing the operations on the runtime datatable.


AddSheet:-It is used for adding a new sheet to runtime datatable.

Syntax:-DataTable.AddSheet("Sheetname")

Example:-DataTable.AddSheet("Sheetname")

DeleteSheet:-It is used for deleting a specified sheet from runtime datatable.

Syntax:-DataTable.DeleteSheet("Sheetname")

Example:-DataTable.DeleteSheet("laxmi")

Import:-It is used for importing all the sheets from Excel sheet to runtime datatable.

Syntax:-DataTable.Import"Path of Excel sheet"

Example:-DataTable.Import"d:\excel1.xls"

ImportSheet:-It is used for importing a specified sheet from Excel sheet to runtime datatable.

Syntax:-DataTable.ImportSheet"Path of Excel Sheet",Source sheetid,Destination sheetid

Example:-DataTable.ImportSheet"d:\excel2.xls",1,1

Here Source and Destination Sheet ids are 1(in this example)

1 is for Global Sheet.

Export:-It is used for exporting a complete runtime datatable(all sheets) to a specified location(path).

Syntax:-DataTable.Export"Path where excel sheet has to be created"

Example:-DataTable.Export"d:\excel3.xls"



ExportSheet:-It is used for exporting a specified sheet from a runtime datatable to specified location.

Syntax:-DataTable.ExportSheet"Path of Excel Sheet",Sheet id which has to be exported.

Example:-DataTable.ExportSheet"d:\excel4.xls",1

SetCurrentRow:-This method is used for setting the focus of QTP to a specified row.

Syntax:-DataTable.SetCurrentRow(RowNumber)

Example:-DataTable.SetCurrentRow(1)

SetPrevRow:-This method is used for setting the focus of QTP to the previous row of the currently focused row.

Syntax:-DataTable.SetPrevRow

Example:-DataTable.SetPrevRow

Check my other hub on qtp scripts

SetNextRow:-This method is used for setting the focus of QTP to the next row of the currently focused row.

Syntax:-DataTable.SetNextRow

Example:-DataTable.SetNextRow

GetSheet:-This method is used for making QTP to focus on a specified sheet.

Syntax:-DataTable.GetSheet(SheetId)

Example:-DataTable.GetSheet(1)

GetSheetCount:-This method is used to get count(number) of sheets in datatable.

Syntax:-DataTable.GetSheetCount

Example:-DataTable.GetSheetCount

GetRowCount:-This method is used for getting row count of a sheet.

Syntax:-DataTable.GetRowCount

Example:-DataTable.GetRowCount

By default it will get row count of Globalsheet.

If u want to get row count of a specified sheet then we have to use GetSheet method.

Syntax:-DataTable.GetSheet(SheetId).GetRowCount

Example:-DataTable.GetSheet(2).GetRowCount



Value:-It is used for capturing a value from a specified column,specified sheet and currently focused row.

Syntax:-DataTable.Value("column name"/column id,SheetId)

Example:-DataTable.Value("A",2) or DataTable.Value(1,2)

Tuesday, 3 July 2012

SOME FAQ'S IN QTP



Questions
1.What is Add – in Manager?

2. Qtp Default Add – ins?

3. Components of Qtp Tool?

4. Run time object?

5 Test  Object?

6. Advantage of Test Automation?

7. Types of Test tools?

8.what is  Functional Testing?

9. Explain Qtp IDE?

10. Qtp Testing Process?

11. Descriptive programming?

12.Record & Running?(Automation menu)

13. Object Repository?(Resource menu Ctrl+R)

14. Explain Object spy?

15.What Type of License available in Qtp?

16. Dis – Advantage of Recording Tests?



DESCRIPTIVE PROGRAMMING


Description Programming
-->If we specify description of the object in the program itself that can be called as Description Programming
-->Using Description Programming we can execute test script without objects in object repository
-->we can execute the test script without object repository
Advantages
Fast Execution
Easy to identify the objects
we can prepare scripts without having build
Dis-Advantages
->It takes lot of time to design test script Time consuming for test script design
To Design DP,there are two ways
1.Specifying the properties and its values directly in the script
2.Description Object
Syntax/Code
Browser("p1:=value").Page("p1:=value").object("p1:value").operation/method
p1=property

Ex:
prepare descriptive programming for "Login" Opeartion in Flight Reservation
->Systemutil.Run "C:Location of the file to open"
->Dialog("text:=Login").WinEdit("attached text:=Agent name:").set "value"
Dialog("text:=login").winedit("attached text:=Password").set "mercury"
Dialog("text:=Login).winButton("text:=OK").click
window("text:=Flight reservation").close

Description Object
to create description object ,we can follow below syntax:
syntax:set object Name=Description.create
object name("Property name").value="property value"
Ex:Description programming for fligh t application
set dia=description.create
dia("text").value="Login"
set Ana=description.cretae
Ana("text").value="agent name"
set pwd=description.create
pwd("text").value="Password"
set but=description.create
but("text").value="OK"
set wc=description.create
wc("text").value="Flight Reservation"

systemutil.run "path of exe"
dialog("dia").winedit(Ana).set="testest"
dialog("dia").winedit(pwd).set="mercury"
dialog("dia").winButton(but).click
window(wc).close

Monday, 2 July 2012

Object Repository

During Recording
Step1:Start Recording
2.Learn Object(Storing object in
obj Repository)
3.Script Generator
During Run
4.Catch Entry in object repository
  (
obj properties in object repository)
  (match the properties in AUT)
5.Identify the object in AUT
Object Repository
àInterface between QTP Script and the application
àContains logical Name and physical description of the objects
àThe object Repository window displays as tree of all objects in the current action
Navigation:
Go to the Resources Menu->Object repository

There are 2 types of object repository
 
Per action object repository
  Stores objects that are associated with specific component[action],so that only that component can access stored objects.
Shared object repository
Stores objects that can be accesses by multiple components
 
Object Repository Manager
 The object Repository Manager enables you to open multiple shared object repositories and modify them as needed.You can open shared object repositories both from the file system
 
Navigation:Go to Resource Menu-->Object Repository manager(ORM)


Operation performed by ORM
  Creating new OR
  Open New OR
  Saving OR
  Closing OR
  Manipulating objects in shared object repository
  Managing Repository parameters
  Modifying Test Object Details
  Locating objects
  Performing merge operations
  Performing Import and export Operations
  Object repository comparison tool
Navigation: Go to Resource Menu
  ORM
  ORM tool Menu
  OR comparison Tool
  Object repository Merge tool
  
Navigation: Resource
  ORM
  ORM-Tools Menu
Or Merge tool
 Merge and associate Repository
 Navigation:
   Generate Script for application, observe objects are stored in object repository
   Export and save the objects(OR1) of script1,using object repository(Resource
menu,click Object repository
   In object repository go to file menu and click on "export local object" an save it into existing folder
  Generate Script for another application, observe objects are stored in object repository
   Export and save the objects(OR2) of script2,using object repository(Resource menu, click Object repository
   In object repository go to file menu and click on "export local object" an save it into existing folder
Go to qtp->Resource menu-->select object repository manager
  In ORM go to tools menu click on object repository merge tool and select primary file as OR1 and secondary file as OR2 and click on ok
save file as OR3
  Associate or3 in script1 and scripts2,while navigation to QTP resource menu and click on associate repositories and add repositories
ie., OR3 to action1 and click on ok
Run the scripts and observe results(both scripts are used as single repository
 Object spy
It is used to view object properties & operations
Displays
  object hierarchy tree
  properties
  native properties(Run time Properties)
  Identification properties(Test Object properties)
  Operations
  native operations(run time operations)
  Test object operations
navigation
Tools
  object spy