how to create user defined functions in QTP? can any one
expalin me with example..
Thanks in Advance for help

Answer Posted / manjunathareddy

User Defined functions nothing but A function which is not
related to project.

(Note :- Bulit in functions are Function which are Available
in QTP Library EX:- Len,StrComp etc,etc)

Example :- i will take zip folder function expample as user
defined function.

Function Zipfolder(oSource,oDestination)
On Error Resume Next
Err.CLear
Set Fso=CreateObject("Scripting.FileSystemObject")
Set oFile=Fso.OpenTextFile(oDestination,2,True)
oFile.Write "PK" &Chr(5)&Chr(6)&string(18,Chr(0))
oFile.Close
Set oShell=CreateObject("Shell.Application")
oShell.NameSpace(oDestination).CopyHere
oShell.NameSpace(oSource).Items
Do until
oShell.NameSpace(oDestination).Items.Count=oShell.NameSpace(oSource).Items.Count
WScript.Sleep 100
Loop
End Function

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Hi All , How can we decicde for pariticular frame(DataDriven or Keword Driven)in Project? Thanks Balaji

1367


Hi Friends, Im planning to do certifcation in mercury Automation Tool QTP.But I Didnt get any clear details regarding course syllabus, fees, where to approach, and which certification would be useful for the experienced testers? can any one send me the details?

1509


Object repositories types, which and when to use?

569


what function you write to do database testing with the help of qtp?

1352


How did you resolve conflicts present in Object Repository?

1609






I opened gmail login into gmail and i have to save (Pass or move) all the mail into notepad please give me code Thanks of all

1507


Explain about Test Fusion Report of QTP?

606


Can any one send me the QTP Basic Coding Samples?

1606


Explain different types of checkpoints?

551


can u explain the keyword driven framework with an example clearly how to create all the files and how to attach to main test.

5084


1--How many functions u develop 2--What is an array 3-- where is ur server 4--U involved in unit testing 5--how ur test the background colour using QTP

1533


How to find the difference between 2 dates in qtp?

566


Is it possible to change the property value at runtime? How it is possible?

566


Diff b/w test scenario's and test Procedures?

1618


Define Error Pane of UFT?

682