我可以确定当前的测试执行人员是来自测试实验室还是来自 QTP IDE 中的交互式测试?

发布于 2024-10-02 11:24:42 字数 697 浏览 3 评论 0原文

检查当前 QTP 测试执行是否是交互式的(即不是从 QC 测试实验室启动的 QC 测试集执行的一部分)的最有效方法是什么?

你们知道一个很酷的方法吗? WR 曾经有一个批处理运行标志,对于 IDE 内的所有执行,该标志都会被可靠地清除。也许QTP有类似的东西,而我忽略了?

首先,我考虑查看 OnError 属性:

Set qtApp = getObject("","QuickTest.Application")

qtApp.Test.Settings.Run.OnError 现在返回以下可能值之一: “对话框”、“NextIteration”、“停止”或“NextStep”。

这将允许我查看 OnError 设置,它可能是 <> “对话框”和<>当执行是测试集的一部分时“停止”,但是:

  • 我设法在所有 QTP 测试中避免自动化接口,这将是我的第一个例外(早期的 QTP 版本感到困惑并启动了第二个 QTP 实例,产生了很多问题...)
  • 测试人员可能会在 QTP IDE 中执行“交互式”运行,并将此设置设置为“NextStep”或“NextIteration”,然后我会在代码中误解它。
  • 即使没有出现对话框(由于从 QC 测试集执行),它也不起作用,返回的值是“Dialog”。卫生部!

What is the most efficient way to check if the current QTP test execution is interactive, i.e. not part of a QC test set execution launched from the QC test lab?

Do you guys know a cool way? WR used to have a batch run flag which reliably was cleared for all executions from within the IDE. Maybe QTP has something like this, and I overlooked it?

First, I thought about looking at the OnError property:

Set qtApp = getObject("","QuickTest.Application")

qtApp.Test.Settings.Run.OnError now returns one of these possible values:
"Dialog", "NextIteration", "Stop" or "NextStep".

This would allow me to look at the OnError setting, which probably is <> "Dialog" and <> "Stop" when execution is part of a test set, but:

  • I managed to avoid the automation interface in all my QTP tests, this would be my first exception (earlier QTP versions got confused and launched a second QTP instance, creating lots of problems...)
  • A tester might do an "interactive" run from within the QTP IDE with this setting set to "NextStep" or "NextIteration", which I then would misinterpret in my code.
  • It does not work, even if dialogs are not coming up (due to execution from a QC test set), the value returned is "Dialog". DOH!

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

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

发布评论

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

评论(2

挖个坑埋了你 2024-10-09 11:24:42

无需转到自动化对象,它在 Setting 对象中公开。

If Setting("IsInTestDirectorTest") Then
    Print "Run from QC"
Else
    Print "Not run from QC"
End If     

请注意,TestDirector (TD) 是 QualityCenter (QC) 的历史名称。

No need to go to the automation object, it is exposed in the Setting object.

If Setting("IsInTestDirectorTest") Then
    Print "Run from QC"
Else
    Print "Not run from QC"
End If     

Note that TestDirector (TD) is the historical name of QualityCenter (QC).

壹場煙雨 2024-10-09 11:24:42

选项

Public Function IsTestSetRun ()
    Dim Result: Result=false
    If not QCUtil is Nothing then
        If not QCUtil.CurrentTestSetTest is Nothing then
            Result=true
        End If
    End If
    IsTestSetRun=Result
End Function

它可能是一个基于 QCUtil.CurrentTestSetTest 的 。不幸的是,如果您以交互方式运行 GUI 测试,它会返回 true,因此它并不是一个真正完整的解决方案。

但由于其他选项不适用于 BPT 组件,因此我现在使用此选项。

It might be an option to use

Public Function IsTestSetRun ()
    Dim Result: Result=false
    If not QCUtil is Nothing then
        If not QCUtil.CurrentTestSetTest is Nothing then
            Result=true
        End If
    End If
    IsTestSetRun=Result
End Function

which is based on QCUtil.CurrentTestSetTest. Unfortunately, it returns true if you run a GUI test interactively, so it is not really a complete solution.

But since the other option does not work with BPT components, I am now using this option.

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