我在RCPTT中开发了一个ECL脚本来测试RCP应用程序。在测试期间,它会设置一些设置并保存。当测试按“确定”时,可以打开一个信息窗口,通知用户此更改需要重建项目。
我的问题是这个窗口不会一直显示。如果在运行测试的工作空间中,此窗口已经打开,并且已经设置了“Remmenber my decision”选项,则它将无法打开。
我想在我的测试中使用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
}
在我的情况下哪个属性是好用的?启用,可见还是两者兼而有之?
答案 0 :(得分: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}
}