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

What are default add-ins in qtp?

14 Answers   Semantic Space,


where the object repository is located?how to choose the object repository as shared or action object repositories?

4 Answers   Datamatics,


I wanted to create Data Driven test for login page (loginname,password). Password is same for all the loginnames. I recorded the script for one user. I mentioned all the user names in the global excel sheet with the column name as "Loginname". I mentioned 5 loginnames. I selected tools- >datadriver and select loginname. Select parameterize and select parameter all option.Changed the parameter name to "loginname" which i mentioned in the global excel sheet. I executed the script. For the users 2 and 4 only, the script is failing... can anybody explain why the script is failing for users 2 and 4.

2 Answers  


How to capture screenshots of Exceptions/Errors during run- time?

12 Answers   Ordain Solutions,


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

4 Answers   Kanbay,






i'm using QTP 8.2, How should i select(browse) object repository from desktop(or from local local drives like C:\,D:\)?. Note:- object repository to select(browse) is been sent by some other person who is using QTP 9.0

1 Answers  


To count the no of links present in the yahoo home page i have written the script like this Set fileSysObject=createobject("Scripting.FileSystemObject") Set linksFileName=fileSysObject.opentextfile ("D:\samplelinkfile.txt",2,true) Set linkDescObj=description.Create linkDescObj("micclass").value="Link" Set noOfLinks=browser("yahoo").Page("Yahoo! India").ChildObjects(linkDescObj) For i=0 to noOfLinks.count-1 linkName=noOfLinks(i).getROProperty("name") linksFileName.writeline(linkName) Next linksFileName.close Set fileSysObject=nothing While running the script it showing error that object "yahoo"isnot found in the object repository. Is there any setting before running the script? if yes what is the steps for it.Im using QTP9.0

2 Answers  


How to find local host name using QTP?

6 Answers  


What is the entry and exit point of automation testing

2 Answers   Infosys,


What are the most frequent errors you faced while executing your scripts?

4 Answers   Semantic Space,


How many test scenarios you have automated? How many time it will take to execute 30-40 scenarios? What SDLC model you are following? How often you will execute your test scripts? Because of some changes, your test scripts failed? When you will update your test scripts? How much time it will take to update? Do you know how to connect database? Do you know the direct method to count no. of records (or) rows present in record set once query is executed? How will you create the connection string? How did you resolve conflicts present in Object Repository? How good you are in VB? How will you work on Excel Application? How will you select Excel sheet? If you want to select 10 sheets, will you create 10 separate objects? Given string is “abcd”. What are the methods you will use to display “dcba”? Drives script – explain the frameworks? How you are updating results for each test? What is start up, configuration, navigation scripts? If you are not able to understand the application (some module), who will teach you? What test cases to be automated? When to be automated? What is the testing process you are following? What life cycle you are following? When you will use Descriptive Programming? Do you have the permission to add objects into shared object repository? (OR) someone will maintain SOR? Do you know how to add objects into shared object repository? How many test cases you have automated? How much time will it take to execute? What is complex in automation? When you feel automation is complex? Tell me one scenario, the complex functionality you have automated in your project? Excel sheet having some datas and some datas present in the application (in table). How will you compare these two datas? Write code to fetch datas from Excel sheet. Rate yourself in SQL? Display the employee name who is getting maximum salary? sal ID Salary name 001 100 002 500 003 300 ID 001 002 003 Ename A B C Have you written any test cases while you are in Automation? Manual Testing also will you do or you will work only in automation?

0 Answers  


What is an Regular expression doing in VBScript?Tell the pattern for the email verification.

0 Answers   Accenture,


Categories