I am just a beginner in QTP. Could any one explain me in
detail how to automate adding two numbers and getting the
result in QTP. Also I would like to parameterize the
inputs. I have tried but getting an error like 'Can't use
sub.....'(can't recollect the exact error)

Answers were Sorted based on User's Feedback



I am just a beginner in QTP. Could any one explain me in detail how to automate adding two numbers..

Answer / ram

you can write function to add two numbers and call in qtp.

file-->New-->function Library

Public function add(a, b)
add=a+b
End Function


Save it where ever u want with add.vbs

Now File-->settings-->Resources-->Add function library--
>click at add(+) button below one button will appear click
that and add the saved library file(add.vbs).

in qtp normal file

write print add(4,5) and u can parameters as your wish.



add this in

Is This Answer Correct ?    0 Yes 0 No

I am just a beginner in QTP. Could any one explain me in detail how to automate adding two numbers..

Answer / sailaja

One way is:Dim a,b,c
a=10
b=20
c=a+b
msgbox c

Anotherway:Place the input parameters in these: edit-
>Action Properties->Parameetrs->Here we can add input &
outputparametrs.
Dim a1,b1
a1=Parameter("a")
b1=Parameter("b")
c=a1+b1
msgbox c

Aliter: Add the values of both a,b of parameters in Action
Properties.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More QTP Interview Questions

what is meant by Implicit and explicit requirements?

0 Answers  


How can you delete the results file (XML)

2 Answers  


How should I get results when I run scripts in a Batch mode

1 Answers   TCS,


Is it possible to change the name of a test object. I mean when we are recording the script for an object (for Ex: Username is a text field which has value "Babu",i am recording that). Then the Name of the object will become "Babu" in object repository. If i want to change "babu" as "xxxxx" .. is it possible to do? Pls help me in this .. if you didn't understand the question, pls let me know.

4 Answers  


how to test load test and block box testing an a web based application pls give ans briefly

0 Answers   Impiger,


What is contained in the object repository?

0 Answers  


why we are using environment variables instead of global variables?

1 Answers   TCS,


How to check the URL using Automation tool QTP

2 Answers  


How to analyzing test results using quicktest professional?

0 Answers  


Is QTP Supports SWT applications? If yes, can you write a sample script for opening a new package in eclipse.

0 Answers   IBM,


What is an object repository?

0 Answers  


Why qtp always start action1 and does not start action?

0 Answers  


Categories