【问题标题】:Wrapper for TestComplete Function "FindChild"TestComplete 函数“FindChild”的包装器
【发布时间】:2015-05-14 22:55:20
【问题描述】:

请原谅我对 JS/JScript 架构的了解不足。

我正在尝试存储FindChild 调用的参数,以便轻松打印以进行调试。根据this guide.

的说法,我对其他路线持开放态度,但目前的尝试涉及包装器功能
var FindChildParamsText = ""; 
(function() {
    var copy = FindChild;
    FindChild = function() {    
       FindChildParamsText = copy.arguments;
       return copy.apply(this, arguments);
    }
})();

我在访问要复制的原始方法时遇到问题。 GetMethods 是我应该研究的吗?如果是这样,开销将变得比我想要的更多。

【问题讨论】:

标签: jscript testcomplete


【解决方案1】:

像这样写一个包装函数:

function FindChild(Obj, PropNames, PropValues, Depth, Refresh)
{
  // Access PropNames and PropValues as you need
  ...

  var result = Obj.FindChild(Obj, PropNames, PropValues, Depth, Refresh);
  return result;
}

并替换测试中的所有 FindChild 方法调用

obj.FindChild(...);

使用这个自定义函数:

FindChild(obj, ...);

【讨论】:

    猜你喜欢
    • 2021-02-27
    • 1970-01-01
    • 1970-01-01
    • 2021-04-06
    • 2016-07-21
    • 1970-01-01
    • 2017-11-05
    • 2012-04-11
    • 1970-01-01
    相关资源
    最近更新 更多