本文介绍了获取到Quality Center API接口ISupportCopyPaste参考使用专业的QuickTest的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

质量中心OTA API提供了像ISupportCopyPaste(使用剪贴板复制/粘贴数据)接口。该记录的方式去实现接口一提的是:

Quality Center OTA API provides interfaces like ISupportCopyPaste (copy/paste data using clipboard). The documented way to get a reference to an implemented interface is:

'Declare a variable to hold the reference for the interface 
Dim bf As IBaseFactory2 
' By assigning the implementing object reference to the 
' IBaseFactory2 type variable, the type is cast to that of the 
' implemented interface. The new variable is a reference to the 
' IBaseFactory2 interface within the parent object. 
' tdc is the global TDConnection object. 
Set bf = tdc.BugFactory

以上code在VB(我不希望使用)。结果
但是,QTP不允许'为'Dim语句。结果
谁能告诉如何使用QTP获得一个参考?结果
任何其他解决这个问题?例如:使用Python的Win32

The above code is in VB (which I don't want to use).
However, QTP does not allow 'As' in Dim statement.
Can anyone tell how to get a reference using QTP ?
Any other solution to this problem ? eg: using Python Win32

推荐答案

原因QTP的不允许暗淡语句的仅是QTP脚本基于VBScript中的不可以 VB和是VB( VBScript是动态类型)。

The reason QTP "doesn't allow As in Dim statement" is that QTP scripts are based on VBScript not VB, and As is VB only (VBScript is dynamically typed).

如果您要使用OTA在QTP,您可以尝试使用QTP公开 QCUtil 对象(请参阅QTP的更多信息,帮助)。

If you want to use OTA in QTP you can try using the QCUtil object that QTP exposes (see QTP's help for more information).

如果 QCUtil 不给你你需要,你可以使用一个知道如何使用COM以创建OTA对象交互(这些语言包括任何语言的对象但不限于,VB,VBScript中,C ++和.NET语言,我不知道有关Python)。

If QCUtil doesn't give you the objects you need you can use any language that knows how to interact with COM in order to create the OTA object (these languages include but are not limited to, VB, VBScript, C++ and .NET languages, I'm not sure about Python).

如果你选择使用VBScript,您可以使用创建OTA对象VBScript的功能(搜索了解详情)。

If you do choose to use VBScript you can create the OTA object using VBScript's CreateObject function (search for CreateObject OTA for more information).

这篇关于获取到Quality Center API接口ISupportCopyPaste参考使用专业的QuickTest的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 02:19