【发布时间】:2019-03-05 18:25:43
【问题描述】:
在我的测试用例中,我决定是否要切换我的单选按钮。我检查我的单选按钮是否没有checked 属性,如下所示:
TestObject srcCurrOpModeRadioBtn = guiUtils.createControl('config-src-op-mode-currentradio')
if(WebUI.verifyElementNotHasAttribute(srcCurrOpModeRadioBtn, 'checked', 5)){
TestObject srcCurrOpModeToggle = guiUtils.createControl('config-src-op-mode-current')
WebUI.click(srcCurrOpModeToggle)
WebUI.delay(1)
}
当我的对象没有checked 属性时,这可以正常工作,但是当我的对象已经是checked(处于我想要的状态)时,我的测试用例会失败。我怎样才能使它不会失败,而是执行剩余的测试?
简单来说,我有一个在 2 种模式之间切换的开关,我们称它们为 mode1 和 mode2。这个特定的测试测试 mode1 的偏好,所以在测试 mode1 的偏好之前,我必须切换到 mode1。我的逻辑在测试开始时处于模式 2 时有效,但当我已经处于模式 1 时它会失败。 I know that it fails because when mode1 is selected, its radio button already has a checked attribute and so the if statement fails but I don't want my test case to fail because of this, I want to test mode1's preferences .
【问题讨论】:
标签: katalon-studio