Thursday, August 30, 2012

Identify objects using Firebug and IE developer tools

In most of the cases we need to spend more time for understanding the objects and to make use of it correctly in automation perspective. Many applications bound to be challenging for automation using QTP though it has in-built repository and spy to identify objects. Despite similar objects having unique properties made us to go for further analysis, at these time many of us will try descriptive program or some other approaches, even for these approaches we need basic understanding over the objects and its hierarchy.
For this purpose we can use following free of cost tools for easy approach
  • Firebug for mozilla browser
  • IE Developer tools for Internet Explorer
FireBug

For Firebug you can either go for mozilla addon page or  directly download from firebug site. Using this firebug you can easily do analysis and understand the hierarchy of the web pages.





Developer Tool 

It's an inbuilt tool coming with Internet explorer, To open this Menu -> Tools -> Developer Tools(F12). Which also facilitate the developer to examine the code and understand for their coding approaches.


Thursday, July 26, 2012

Inserting Excel formula into QTP Datatable

As we know we can write formula's using vb script directly in to excel, but here I am trying to insert excel formula's in datatable. Usually we use datatable to ease our scripting but inserting excel formula's will throw error on exporing the datatable, Let us consider the following script

datatable.Value("A",2) = "2"
datatable.SetCurrentRow(2)
datatable.Value("A",2) = "3"
datatable.SetCurrentRow(3)
datatable.Value("A",2) = "=(A2+A3)"
datatable.SetCurrentRow(4)
datatable.Value("A",2) = "=HYPERLINK(""C:\Documents and Settings\1419084\My Documents\IP_Config.bmp""|""Click to see Image"")"
datatable.ExportSheet "C:\Documents and Settings\1419084\Desktop\FI_Overview\2.xls","Action1"


In above script I'm trying to insert two formula's one is addition and other is hyperlink. While running the script throws following error on datatable export.

Though the formula is captured on datatable but it's throwing error, after stopping the run we can able to see the datatable with formula in results. Despite it throws general error while exporting the datatable.
Here I'm inserting single quote(') before the formula to handle this problem, after executing the test open the Excel and remove the single quote(') using format painter to recover the formula. This method reduced a lot of time for me while capturing screen shots.


Wednesday, July 18, 2012

QTP Repository for easy understanding


QTP Repository is used to store objects that can be reference Testing Applications during Automation test runs.





Property of the objects can be predefined in QTP as follows
1. Mandatory Property
2. Assistive Property
3. Ordinal Identifier

Mandatory Property
QTP priorities mandatory properties defined in the Object Identification section for particular object.
Refer Images above and below where these below properties highlighted in mandatory section.
  Html tag, name and type

Assistive Property
QTP uses Assistive property when mandatory property of the object matches more than one object being saved in OR.
Refer the below Image for better understanding. In Webpage Cache link appears more than a time so QTP refers for Assistive property.


  
 
Ordinal Identifier
QTP refers Ordinal when the above mentioned properties are not sufficient to identify the object being saved in OR. Here we can specify object Index, Location and Creation Time as property.