QTP Misc
QTP Misc
Log Tracking functionality helps you work with developers to pinpoint the root
causes of unexpected behavior in your application
QuickTest 11.00 provides Web Add-in Extensibility-based add-ins for ASP .NET
Ajax, GWT, Yahoo UI, and Dojo Web 2.0 toolkits
Compare, Merge, and Export Object Repositories with Checkpoints and Output
Values
One Unified Tool for GUI + API testing (Merger of QTP + Service Test)
File Content Checkpoints(New checkpoints for PDF, HTML, Word, TXT, and RTF
files)
Test your work against an SAP server by importing IDocs and RFCdefinitions from
your SAP systems(API)
Record Toolbar
Supports storing and managing your GUI tests in SAP Solution Manager
7. Can you please tell the various ways to access the Excel
datasheet?
4. Yes, dont get me wrong just try out the following line
of code in UFT, you can verify it:Dim var : var = 0
Writing the IF condition without End if
IF var=0 THEN MSGBOX Zero ELSE Non Zero
Loop
Obj.RS.Close
ObjADO.close
2.Dictionary is more flexible and is richer in terms of built-in functionality. (It has range of
methods and properties like Items, remove, Keys,Exists)
Example:'Creating Dictionary Object
Set obj = createobject("scripting.dictionary")
'Using Add methods to add values to dictionary object
obj.Add "UFT","2012"
obj.Add "QTP11","2010"
obj.Add "QTP10","2009"
3.Dictionaries also work better when you want to locate items by their content rather than
4.Array uses ReDim to vary the size while we don't need this in dictionary's .
'Declaring array
Dim arr()
'Resizing Array
ReDim arr(1)
arr(0) = "UFT"
arr(1) = "QTP11"
msgbox arr(0)
5.When you delete a particular item from a dictionary, all the subsequent items
automatically shifts up
6.Most important of all is that Array can have index only as numeric (0,1,2..) while we can
use keys to identify dictionary items and Keys can be of any data subtype(String,integer),
except an array or dictionary.
7.Dictionary can't be multidimensional like Array's
PART-2
We want UFT to select checkbox in the table corrensponding to company name of "Oracle".
Chaitanya C said:
29 October 2013 10:16
nIndex=Browser("").Page("").Frame("MainFrame").WebTable("").GetRowWithCellText("Oracle")
Now Use DP
Set chkobj =
Browser("").Page("").Frame("").WebTable("").ChildItem(3,2,"WebCheckbox",0)
chkobj .Set "ON"
PART-3
Answers to Part-5
I am giving just giving brief pointers, incase more details are required please Contact Us
1.Windows
2. Windows, Solaris, Linux
3.IE,Firefox,Chrome
4.Yes, using Database checkpoint
5.Yes
PART-6
In one of the interview i was asked to write test cases on "Credit Card", thought of sharing with testing
community , please feel free to add and extend the cases.
Physical appearance/Usability:
Credit card width, height so that it can be swiped into card reader machine
Functionality:
Credit card asks for pin after swiping into card reader
Incase card has chip facility then both dip and swipe should work
Session expiry
PART-7
1. How many types of Array are there?
2. Can we redefine the index of an Array?
3. What is the difference between an Array and Dictionary Object?
4. How can we get lower index and upper index of an Array?
5. If Array is of index 10, how many variables it can store?
6. What will be the output of following code :Dim arr(3)
For i = 0 to 3
arr(i) = i+1
Next
Msgbox arr(4)
7.Write a code for assigning values to a 2-D array?
8.Why we use "Preserve" keyword in Array?
=======
Today we are sharing some of the frequently asked manual interview questions:-
1.
2.
3.
4.
5.
6.
PART-9
1.What is the difference between Action and Function in UFT?
2.Explain the difference between image and Bit map check point?
3. Difference between verification and validation ?
4.Methods available in Reporter utility object?
5.How to get last four digits of "UFTHELP"?
6.Regression v/s Re-Testing?
bitmap so that it can be compared with the expected and the actual bitmap
3. Checking that a "shoe" is of given size = Verification , Wearing shoe and checking the size
is validation
4.ReportEvent, ReportNote
5.Using vb scripting "Right" function:- Right(string,4)
.Why we use Automation Testing?
2.How we can Merge Object Repositories in QTP?
3.Please tell me the steps for connecting QTP with Database?
4.How we can copy text from Notepad and Paste in Excel?
5.What type of Framework you have worked?
6.Can we implement "Modular" Framework in "Keyword Driven" Framework?
7.Explain the latest Bug you have logged using QTP?
6.Please give one liner for COM and WSH in context with QTP/UFT?
7.Explain scenario's where we can avoid Automation?
8.Why we use Object Spy?
9.Difference between various recording modes in QTP/UFT?
Hints:1.To get the "Absolute Path".
3.It is a Utility object which is used in OTA (Open test Architecture)
4.Wait, WaitProperty,Exist, Sync(Only Web),File-Settings-Run Tab-Increase
object synchronization
7.Usability Testing, ASAP testing, No ROI , Task is not Repetitive
XPath is another important Web Object Identifier introduced in QTP 11. It is one of the widely used
identification strategy in open source tools. In this tutorial we will understand using XPath for locating Web
objects in your application with QTP.
Introduction to XPath
XPath is used for locating nodes in an XML document and it can also be used for locating HTML
elements in XHTML. XPath opens up all sorts of new possibilities for locating complex & dynamically
rendered elements.
Awkwardly, developers not always follow best practices or testability guidelines while building the
applications. XPath comes to your help when you dont have a suitable id or name attribute for the
element you wish to identify. You can use XPath to either identify the element in absolute terms or relative
to an element that does have an id or name attribute. XPath locators can also be used to specify elements
via attributes other than id and name.
Using XPath for Web Object Identification
QTP 11 has added XPath Object Identification Property to all Test Objects in Web Add-In. QTP offers two
ways to use XPath, you can either instruct QTP to record Automatic XPath by settings Options in Tools
menu or you can specify User Defined XPath in xpath Property.
You can also enable and use xpath Property in Object Repository or in Descriptive Programming. In
following example a direct XPath query is used to identify Search Text Box on Google:
Browser("title:=Google").Page("title:=Google").WebEdit("xpath:=//input").Set "What
is XPATH"
In above example we used //input to identify the Search Text Box. Using // in XPath query is called greedy
query as it parses the entire HTML DOM until it finds the desired element. This way is useful when
objects are dynamically positioned; however it takes certain amount of time to find the element.
However if you are certain about position of the desired element, you can use a direct XPath query by
using single /, however please make you sure that the HTML is first node in your query. Following
example shows direct XPath query for User Name Text Box on Gmail Home Page:
Direct XPath query will find the element quicker, however if application GUI is going to change, it may fail
if the element is moved into a different area of the Page.
Using Element Attributes in XPath
We can use various element attributes such as ID, Name, Value, Type etc. to identify element in following
way:
In following example, ID attribute is used to identify User Name Text Box on Gmail Home Page:
We can also use combination of attributes in XPath query so that we can try to make the element more
unique for identification:
value']
In following example, we will identify and check Stay signed in Checkbox on Gmail Home Page:
In following example, developers have assigned dynamic IDs for all the input elements in following way:
1
2
3
<div id='login_area'>
<input type='text' id='text_1'>
</div>
We can use either starts-with() or contains() function to identify this object in following way:
Locating elements by the text they contain can be quite useful. To identify elements, we need to
usetext() function in XPath query. This will match the entire contents of the element.
//element[text()='inner text']
In following example, we will use text() function to identify the Create an account link on Gmail Home
Page:
We can also use XPath functions contains(), starts-with() or ends-with() for matching partial text.
//element[contains(text(),'text value')]
Exmaple:
The textbox to enter the Quantity and image to add item was buried under layer of div elements inside a td
element in a table. The ids for these elements were generated dynamically and it is difficult to add an item
dynamically from the test script. Here is html code for Quantity textbox:
For Product 1
For Product 2
As you can see in the above code, we cannot rely on id attribute as it changes every time page is
refreshed and secondly name of textbox is not unique.
We need to find a unique way to identify a Product in the table. There are two columns which contain
unique values namely Product & Article column. However Article column contains primary key from the
database so it is highly recommended to use this value as basis to identify the product. We can also use
Product column otherwise. Following XPath Query will identify the cell containing the specified Article
using XPath functions contains() & text():
xpath:=//td[contains(text(),'0002')]
Now we need to find the cell which contains the elements. Here we will use following-sibling axis and
find the third cell from the current cell. Following query will return the cell containing Quantity & Add to
cart image:
xpath:=//td[contains(text(),'0002')]/following-sibling::td[3]
In next step we need to get the actual elements which are located inside the layer of div elements. Here
we need to use descendent axis to find the child elements in the cell:
xpath:=//td[contains(text(),'0002')]/followingsibling::td[3]/descendant::div[2]/input[@name='qty']
2
3
xpath:=//td[contains(text(),'0002')]/followingsibling::td[3]/descendant::div[3]/input[@name='add']
We can remove the nth element, or element Index to make this XPath query more flexible in following
way:
1
2
xpath:=//td[contains(text(),'0002')]/followingsibling::td/descendant::div/input[@name='qty']
xpath:=//td[contains(text(),'0002')]/followingsibling::td/descendant::div/input[@name='add']
VBScript code to enter quantity for an Item and add selected Item to the Shopping Cart in QTP:
1
2
These actions will be used to add multiple items in various test cases. We need to make these actions
more generic and remove the hardcoded Article Id. Following example shows user defined function in
QTP for above steps:
2
3
4
5
6
End Function
However while using XPath we need to consider the fact that these locators are dependent on structure of
the page and the layout of the elements. Any changes to the structure or layout will affect the locators and
tests will result into failures.