I want t开发者_Python百科o reference a function from one Function Library in another in QTP.
This is programming basics but reading QTP help, it looks like everything has to be accessed through the 'Test' layer which means that writing utility functions such as date handlers.
You can indeed write functions in action scripts. You do not have to write function libraries to write and use custom functions. For reusability, function libraries make sense.
You can put as many functions into one function library as you wish.
Should you want to create more than one function library, you simply add them all to the resources settings of each test.
If function libraries depend on each other, you should make sure to reference them in the correct order in the test settings.
There is an
ExecuteGlobal
statement in VBScript which would allow you to specify a (huge) string containing function definitions. Executing ExecuteGlobal with such a string would declare all those functions. This is (besides ExecuteGlobal's sister functions, like ExecuteFile (or what was it called?)) the only real alternative to using function libraries.
精彩评论