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

How many test scripts are prapare in ur project(HeathCare Insurance).

1 Answers   Virtusa,


How to make arguments optional in a function?

6 Answers   Liquid Crystal,


Discuss quicktest professional environment?

0 Answers  


When should u feel that u can stop testing now? The following are few of the common Test Stop criteria:

2 Answers  


what is meant by descriptive programming?

2 Answers   Wipro,






Hi Frriends... I have one Query please give the apropriate ans. when we r working with web based application , the user loggedin page name is changed respect to the username ( Take a exp. Yahoomail.com) .When we use Datadriven test to this scenario ,each time the loggedin page name is changed ...then the script is fail.. at that time wat can do... please give the apropriate ans. Thanx in advance..

3 Answers  


What is the extention of Virtualobject

1 Answers   Accenture,


How to find operating system information using the qtp script?

0 Answers  


QTP in mumbai

0 Answers  


how can we preform retesting(DATA driven test) using function please gine the code for loginpage

0 Answers   W3 Solutions,


How many ways is to parameterize the value?

0 Answers  


What is the current version of QTP?

19 Answers  


Categories