QTP DotNetFactory 与 COM 可见的 .NET 程序集

发布于 2025-01-07 11:22:23 字数 417 浏览 2 评论 0原文

我只是好奇 - QTP 具有直接通过 DotNetFactory 对象调用 .NET 对象的功能,请参阅 这篇文章来自learnqtp.com,不过它也可以通过COM调用对象(参见这篇文章来自乔·科兰托尼奥)。使用一种方法相对于另一种方法有什么优势?据我所知,这两种方法对可调用的对象都有类似的限制(没有带参数的构造函数等),但我想知道更深入的细节。

谢谢!

I'm just curious - QTP has the functionality to call .NET objects directly via the DotNetFactory object, see this article from learnqtp.com, but it can also call objects through COM (see this post from Joe Colantonio). What would the advantage be in using one method over another? So far as I can tell, both methods have similar restrictions on the objects that can be called (no constructors with parameters, etc.), but I'm wondering about deeper details.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心不设防 2025-01-14 11:22:23

首先,您的一个假设是错误的,DotNetFactory确实支持使用参数调用构造函数(这就是可选的args参数的用途)。

CreateObject 函数内置于 VBScript,因为 QTP 测试是用 VBScript 编写的,此功能是免费的,从技术上讲并不是 QTP 功能。 DotNetFactory 是 QTP 的一部分,允许创建 .NET 对象,即使它们不是 COM 可见的。

如果您有一个 COM 可见的 .NET 对象,您可以选择您更喜欢的方法,但如果您有一个 COM 对象,则必须使用 CreateObject,如果您有一个非 COM 可见对象您必须使用DotNetFactory。

First of all one of your assumptions is wrong, DotNetFactory does support calling constructors with parameters (that's what the optional args parameter is for).

The CreateObject function is built in for VBScript, since QTP tests are written in VBScript this functionality comes for free and is not technically a QTP feature. The DotNetFactory is part of QTP and allows creating .NET objects even if they are not COM visible.

If you have a .NET object which is COM visible you can choose which method you're more comfortable with but if you have a COM object you must use CreateObject and if you have a non-COM visible object you must use DotNetFactory.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文