如果UFT 12.02中的函数名称相同,为什么只调用最新的函数? [英] Why only the latest function is called, if the function name are same in UFT 12.02?

查看:72
本文介绍了如果UFT 12.02中的函数名称相同,为什么只调用最新的函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用UFT 12.02.在函数库中,我有一个名为 ReportEvent(Status,TestStep,ExpectedResult,ActualResult,OptionalLink)的函数,另一个名称与 ReportEvent(TestStep,ExpectedResult,ActualResult)相同的函数>.

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).

当我在脚本中调用 ReportEvent 函数时,它将调用两个函数中最高LOC(即要写入的最后一个)中提到的函数.

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.

推荐答案

好吧,我很快找到了答案-它基于vbscript的检查规则,其层次结构如下:

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. 代码是逐行解析的,使用了在相同位置具有相同名称的最后一个函数定义.
  2. 如果在使用ExecuteFile代码加载的函数库中有可用的匹配函数,则将其使用.否则...
  3. 如果操作代码中提供了匹配功能,则使用它.否则...
  4. 如果在使用LoadFunctionLibrary代码加载的函数库中提供了匹配功能,则使用它.否则...
  5. 如果匹配函数在静态关联的函数库中可用,则使用顶级关联的函数库中的定义

因此,特别是对于我的问题-在动作中调用时,将使用最后写入的库文件中的匹配函数. 因此-LOC-50处的 ReportEvent(状态,TestStep,期望结果,ActualResult,OptionalLink) 和LOC -105处的 ReportEvent(TestStep,期望结果,ActualResult).

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

然后使用LOC-105处的那个.

then the one at LOC - 105 is used.

这篇关于如果UFT 12.02中的函数名称相同,为什么只调用最新的函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆