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

How can you identify the browser and its information using the qtp script?

0 Answers  


Can I do Game testing with QTP tool

1 Answers   Google,


QTP identified the object but not performing the desired action???what could be the reason?????

1 Answers   Mphasis,


Consider a scenario where there are two action sheets say action 1 and action 2. Can Action 1 take values from action 2 data sheet or vice versa. If so, how?

6 Answers   Oracle, TCS,


What is output value?

3 Answers  


What type of automation frame work you are using?and why?

2 Answers   Wipro,


What is test object model in QTP ?

8 Answers  


What do you mean by checkpoints in qtp?

0 Answers  


what are the challenges you have faced while testing web based application using the automation tools ?

0 Answers  


How exactly you start scripting in QTP? In the interview he was not satisfied with my answer.Please post what is correct answer.

2 Answers  


What’s the QTP testing process?

1 Answers  


what is the Debug view?

1 Answers  


Categories