Why only the latest function is called, if the function name are same in UFT 12.02?

三世轮回 提交于 2019-11-30 19:14:28

问题


I am using UFT 12.02. In the function library I have a function as ReportEvent(Status, TestStep, ExpectedResult, ActualResult, OptionalLink) and another function with the same name as ReportEvent(TestStep, ExpectedResult, ActualResult).

when I call the ReportEvent function in my script it calls the function that mentioned at the highest LOC of the two i.e. the last one to be written.

it doesn't stop my work but my curiosity got better of me and I thought may be y'all might be able to help.


回答1:


okay I found an answer to this, swiftly hopefully - it is based on the check rules of vbscript, which in hierarchy are as follows:

  1. Code is parsed line by line, last function definition with same name in same location is used.
  2. If matching function is available in function library loaded using ExecuteFile code, it is used. Otherwise…
  3. if matching function is available in action code, it is used. Otherwise…
  4. if matching function is available in function library loaded using LoadFunctionLibrary code, it is used. Otherwise…
  5. if matching function is available in statically associated function library, definition from top-level associated function library is used

So particularly for my question - the matching function in library file which is written last will be used when called in the action. So - ReportEvent(Status, TestStep, ExpectedResult, ActualResult, OptionalLink) at LOC-50 and ReportEvent(TestStep, ExpectedResult, ActualResult). at LOC -105

then the one at LOC - 105 is used.



来源:https://stackoverflow.com/questions/32824427/why-only-the-latest-function-is-called-if-the-function-name-are-same-in-uft-12

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!