This post is about how to call Function from QTP.
Function:-Its a block of statements that perform a particular task.
Open a notepad and paste the code shown below.
Function f1
msgbox "hiii"
msgbox "function demo "
End Function
and save it as abc.vbs
.vbs is extension for vb script files.
f1 is function name and abc is file name.
Now open a new test and associate the function to new test as shown below
Navigation for associating is:-
1.Click menu item Test.
2.Select option Settings(U can see a window named Test Settings).
3.Click on Resources Tab(U can see + symbol which is used to add a new file to test).
4.Click on + symbol and browse the desired file(here abc.vbs).
U can see ur file path in Associated library files
5.Now click on Ok button.
Note:-This navigation is for QTP 8.2
Now its time to call function just write function name in test and run.
Here in this example function name is f1 so type f1 and run the test.
In this way u can call functions wherever required in ur script.
Let me know your suggestions and opinions on this blog.
Steps to Call Function from QTP
Subscribe to:
Post Comments (Atom)
2 comments:
I have 3 funtionsShoping bag then checkout then payment. When i execute shopping bag by saving it in vbs and running it in test its working fine. But in the same test i try to add checkout and payment function call then change the run setting to associate the repository and datatable then click run it throwsing error. How to run all the three functions sequentially. Please help me
Please help me to execute three functions in single test . Provide me steps
Post a Comment