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

Suppose I want fail that check point? How can you do that?

838


what type of values given to objects. EX::Set oBrowser=Description.Create oBrowser(“micclass”).Value=”Browser”

1694


What is quick test pro? What is a quick test professional?

776


How do you do batch testing in wr and is it possible to do in qtp, if so explain?

684


wt is the use of multiple questions in QTP

1885


How can you exit from an action?

789


How to define array in qtp?

760


What is the qtp testing process?

802


An action has both shared and local or associated to it and both have the same object in them. In the test which one will be considered?

860


Can you write a script to check if the folder exists or not?

714


What is difference between design time and run time data table?

802


I want two test two agents login for the flight website. Here is the scenario: I want to go through 1-3 rows for one user login and other user login I want to go though 3-5 rows. How would you set this up in qtp. Thank You

1706


How many types of object repository in qtp?

825


Does quicktest professional (qtp) is unicode compatible?

748


what is run action?

1643