【发布时间】:2019-06-24 07:15:43
【问题描述】:
当我检查步骤定义文件中的特定黄瓜步骤时,如果条件为假,我想让该特定测试用例停止并失败并继续下一个测试用例。
如果我必须使用FailureHandling.STOP_ON_FAILURE,如何编码?
@When("User enters the (.*) in the Login")
def user_enter_userid_in_the_Login(String uid) {
if (uid=='')
/** FAIL the TEST CASE **/
else
WebUI.setText(findTestObject('Object Repository/ORTC01/Page_/input_userid'), uid,
FailureHandling.STOP_ON_FAILURE)
WebUI.delay(5)
}
【问题讨论】:
-
assert uid!=''或只是assert uid -
谢谢你,jonrsharpe。 如何编写代码?请提及。如何使测试用例失败?
-
def user_enter_userid_in_the_Login(String uid) { assert uid!='' WebUI.setText(findTestObject('Object Repository/ORTC01/Page_/input_userid'), uid, FailureHandling.STOP_ON_FAILURE) WebUI.delay(5 ) } 否则测试会失败?