Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Library Files Calling Ways
#1
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi,
we can call library functions in two ways
ExecuteFile "Path of .vbs File"
or
Associating the library file to the QTP.
Which is best way to use and what r the differences.

Wink
Reply
#2
Solved: 11 Years, 3 Months, 3 Weeks ago
We can use the 2 options, but I will prefer the First one. This will reduce the maintainence if there are any changes to the file names or even file location.
Thanks,
SUpputuri
Reply
#3
Solved: 11 Years, 3 Months, 3 Weeks ago Toungue 
I hope that is not a big difference. even we should not conclude the ExecuteFile is best method with the reason given by you.

why qtp have these two methods? and what are the differences?
Reply
#4
Solved: 11 Years, 3 Months, 3 Weeks ago
Following are the few differences:

1. We have a Library File with following Functions One Public and another Private:

Public Function myPublicFun()
msgbox "I am a public function"
End Function

Private Function myPrivateFun()
msgbox "I am a Private function"
End Function


If we use ExecuteFile method to load the library file, we will be able to access the private function directly. But if the same file is associated we won't be able to access private functions directly (Type Mismatch Error will be thrown).
Please Note that the functions are not inside a class.

2. With ExecuteFile method debugging of your class/Functions become difficult as F11/Step into feature does not work properly.

Regards,
Rajeshwar
Reply
#5
Solved: 11 Years, 3 Months, 3 Weeks ago
Public Function and Private function both are in one library... We can use these both when ever we want, even it is called by ExecuteFile or associated file... I didn't find any difference here. Could you please explain regarding this?

Debugging can't be done if we go with ExecuteFile.
Reply
#6
Solved: 11 Years, 3 Months, 3 Weeks ago
'Test.mts
'------------------
Code:
ExecuteFile "E:\QTP\Library1.qfl" [Change  the file path to your file path]
myPrivateFun()
=======================
1. Place functions in a function Library file(.qfl)
2. Run Above Test, observe that you will be able to access the Private Function.
3. Now Comment ExecuteFile Statement and associate Function Library with the Test.
4. Run Test. observe that Type Mismatch Error is thrown.

Please refer following Snapshots:

Thanks,
Rajeshwar..


Attached Files Image(s)
       
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)