Академический Документы
Профессиональный Документы
Культура Документы
Hi friends - on this page you will find all interview questions on QTP and VB script
In QTP, vbscript is used as a scripting language. 80% of programming you do in QTP is based vbscript
concepts. So There is no doubt that you will face interview questions based upon vbscript.
Answer -You can find the length of the string using one vb script function called len.
Suppose you want to find the length of "salunke" then you will have the below statement which will print
the length of string .
print len("salunke")
Answer - You can find the current system time using Time function in vbscript.
Print time
Answer - We can use replace function in vbscript to remove all spaces in string.
Answer - We can find the modulus of given number using MOD operator.
a = 10 mod 5
print a
Answer - To find the size of array, we can use ubound function in QTP.
Answer - You can pass the parameters to function or procedure using byref or byval method.
byref will pass the address of variable but byval will pass the copy of variable. So when you want the
passed value to change, you can pass the value using byref method. Otherwise you can pass it using
byval method.
Answer:
Min = 1
Max = 10
Randomize
RandomNumber = (Int((max-min+1)*Rnd+min))
Answer - We can create the array of dictionary like how we create array of scalar variables.
Syntax is shown below –
'Declare Array with 5 elements
Dim myArray(5)
'Make first element in array as a dictionary object
Set myArray(0) = createobject("scripting.dictionary")
'Once we have a dictionary object, We can use its methods like add, remove, removeall etc
myArray(0).Add"mykey","myvalue"
'display item value of mykey in dictionary myArray(0)
print myArray(0)("mykey")
myArray(0).removeall
Answer -
Dim a
a = array(2,3,4,5)
Set d = createobject("Scripting.Dictionary")
d.Add "mykey", a
print d("mykey")(0)
Q 11. What is win32 API and how to use it in QTP?
Answer -
win32 API is an API that can be used to perform different administrative tasks. It has many WIN32
classes like Win32_Process etc.
Below Example used Win32 API in QTP to close the process by its name.
2) Pop Up Window: This event is useful in managing various unwanted application windows,
which get built-up at runtime.
3) Test Run Error: This event is useful in handling VBScript statement errors at runtime.
4) Object State: This event is useful in handling object related errors at runtime.
Q. 28: What are the various ways to insert a Action in a test in QTP?
QTP tests our dynamically changing application by learning and identifying test objects and
their expected properties and values. To do this, QTP analyzes each object in our application
in much the same way that a person would look at a photograph and remember its details.
The test object model is a large set of object types or classes that QTP uses to represent the
objects in our application. Each test object class has a list of properties that can uniquely
identify objects of that class and a set of relevant methods that QuickTest can learn about
it.
A test object is an object that QTP creates in the test to represent the actual object in your
application. QTP stores information on the object that will help it identify and check the
object during the run session.
A run-time object is the actual object in our application on which methods are performed
during the run session
QTP captures the visible part of the specified object as a bitmap and inserts a checkpoint in
the test. QTP does not capture any part of the screen which happens to be scrolled off the
screen. We can check an area of an application as a bitmap. While creating a test, we
specify the area you want to check by selecting an object. We can check an entire object or
any area within an object.
Q. 107: How can we compare the image files in the Image Checkpoint?
We can compare the image files in the Image Checkpoint by using the Compare image
content option in the Image Checkpoint Properties dialog box. It compares the expected
image source file with the graphic of the actual image source file. If the expected and actual
images are different, QTP displays them both in the Test Results. If the images are identical,
only one graphic is displayed.
. 109: How do we compare actual cell values with the expected cell values in
Tables in QTP?.
By using the Settings tab we can compare actual cell values with the expected cell values in
tables. By using Verification type option we can compare following types of cell contents.
1) String Content: It is the default setting. It treats the cell values as strings and checks
for the exact text, while ignoring spaces. For example, 2 and 2.00 are not recognized as the
same string.
2) Numeric Content: Evaluates the content of the cell according to numeric values. For
example, 2 and 2.00 are recognized as the same number.
3) Numeric Range: Compares the content of the cell against a numeric range, where the
minimum and maximum values are any real number that we specify.
By the use of Identify columns option available in Cell Identification tab. This specifies the
location of the column containing the cells with which we want to compare the expected
data. This is done in two ways:
1) By position: This is the Default option. It locates cells according to the column position.
A shift in the position of the columns within the table results in a mismatch.
2) By column name: It locates cells according to the column name. A shift in the position
of the columns within the table does not result in a mismatch. This option gets enabled only
when the table contains more than one column.
. 116: What is the maximum number of rows, which can be defined in a database
in QTP?
1) XML Web Page / Frame Checkpoint: This checks an XML document within a Web
page or frame.
3) XML Test Object Checkpoint: This checks the XML data for an object or operation.