How u call functions in QTP

Answers were Sorted based on User's Feedback



How u call functions in QTP..

Answer / charan

syntax for function
fun <fun name>(arg1,arg2)
<statements>
end
for example if u want to call mul(3,6)
call mul(3,6)
function mul(a,b)
mul=a*b
end

Is This Answer Correct ?    23 Yes 1 No

How u call functions in QTP..

Answer / jayalakshmi

Function to calculate the length of characters in a word -

Function countChar(st)/*Vbscript Function
charLength = Length(st)
End Function

Assume above function countChar is written in VBscript, now
you are getting the text from the Application and calling
the Vbscript file and gets the length of the characters in
the word

Dim textValue
textValue= Browser("Browser Name").Page("Page Name").Frame
("mainFrame_5").WebElement("12").GetROProperty("innertext")

executefile "\*.*\countChar(textValue)" /*calling the
Vbscript file
textlength = charLength /*getting the text length

Is This Answer Correct ?    14 Yes 12 No

How u call functions in QTP..

Answer / hitendra

xyz=checkpal("LIRIL","LIRIL")
Function checkpal( strpal ,outstr )
If strpal =strreverse(outstr ) Then
print strpal &" " & strreverse(outstr )
checkpal="Is Palindrome"
else
checkpal="Is Not Palindrome"
End If
End Function

Is This Answer Correct ?    0 Yes 1 No

How u call functions in QTP..

Answer / ravinder

first diclare veriable in note pade and save in vbs file
after that go to new qtp program
use the publec ffunction
end function satement go to test resoruses and add
librarey file run the frogram

Is This Answer Correct ?    3 Yes 8 No

How u call functions in QTP..

Answer / manu

its as simple as calling vbs functions..

Is This Answer Correct ?    5 Yes 16 No

Post New Answer

More QTP Interview Questions

Explain the new feature of UFT regarding the export of test results?

0 Answers  


What is the use of defining a newobject in the object repository "Define New TestOject". How to use this further. If we define new testobject, how can it recognizes the objects properties of any application.

0 Answers  


can we run the scripts of QTP8.2 in QTP7.0?

1 Answers  


Can any one send me the QTP Basic Coding Samples?

0 Answers  


Anybody can tell me what are the common roles and responsibilites of a Automation Test engineer

2 Answers   IBM,


How will you handle application crash using recovery scenario manager(step by step process)?

1 Answers  


How to make arguments optional in a function?

2 Answers   Crea,


How will you test a keyboard?

0 Answers  


How can we record an edit box in the Web application ?

4 Answers   Kanbay,


can any one make me confirm about a real time employee with better experience in QTP who is providing QTP course individually in Bangalore???

3 Answers  


How did you achieve reusability via QTP?

1 Answers  


what is vss and cvs what is main difference b/w these two

3 Answers  


Categories