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 ways to configure the application in QTP,Explain

2 Answers   CTS,


Have you used xml check point in your project?

0 Answers  


It seems Interview questions from Ordain Solutions are almost BASIC LEVEL-Easy. I am asking one tough question..(I think.. May be easy for some people) In recorded script the - WebLink("cityinfo") In reality, the WebLink name is "generalinfo" How you can write function to click that changed web link. NOTE: This functin should work with any Dynamic text link. I will post the answer later.

8 Answers  


Explain about Standard output value, Text output value, database o/p value, Xml O/p value, Xm o/p Value

1 Answers   TCS,


Explain the differences between table and db checkpoints?

0 Answers  






What is Environment Variable and when we apply this in QTP?

4 Answers  


Diff. between keyword driven Data driven testing?

8 Answers   CTS, IBM,


What is a quick test professional?

0 Answers  


how we do database testing with qtp using descriptive programming?

22 Answers   Nutrins, Rohit Technologies, Symphony, Syntel, TCS,


Hi, I am new to QTP and vb.script.How to start to write vb.script in QTP? Please give me suggestions?

3 Answers  


how do u handle an object with out name in our application using QTP 9.2?

0 Answers   CTS,


what is run action?

0 Answers  


Categories