1

我有一个在 RCPTT 中开发的 ECL 脚本,用于测试 RCP 应用程序。在测试期间,它会设置一些设置并保存。当测试按“OK”时,会打开一个信息窗口,通知用户此更改需要重新构建项目。

在此处输入图像描述

我的问题是这个窗口不会总是显示。如果在运行测试的工作区中,该窗口已经打开,并且设置了“记住我的决定”选项,则不会打开。

我想在我的测试中加入一个 if 来处理这两种情况。它应该是这样的:

if [/* what can i put here ?*/] {
    get-window Settings | get-button Yes | click
}

这样的条件怎么写?

我可以做类似的事情if [get-window Settings | verify-true ]if [ not [get-window Settings | verify-error ] ]

编辑:通过使用“记录片段”工具,我得到了类似的东西:

with [get-window Settings] {
    get-property "isEnabled()" | equals true | verify-true
    get-property "isVisible()" | equals true | verify-true
}

在我的情况下,哪个属性是好的?启用、可见或两者兼而有之?

4

1 回答 1

2

在这种情况下使用 try-catch:

try {
    get-window Settings | get-button Yes | click
} -catch {
    // Verify that the window was missing (and not some other problem)
    verify-error -command {get-window Settings}
}
于 2018-06-18T16:06:46.180 回答