我有一个需要编辑员工姓名的场景,当我单击“取消”按钮时,“员工姓名”字段将恢复为原始值。现在,我必须确认“取消”按钮是否有效。为此,我的方法是:
1。使用get属性从字段中获取值
2。清除字段并输入新员工名称
3。单击取消
我的问题是,如果属性值和新雇员姓名相同,我该如何使测试用例失败。我同时使用了If条件和Assert条件。两者均不起作用。对此的任何解决方案
Assert.assertTrue(getLastNameValue.equals(LastName));.//It will fail if both the values mismatch.but i want to make it fail only if both the values are equal
还有我尝试过的另一种方法
if(!getLastNameValue.equalsIgnoreCase(LastName)) {
log.info("Edits are wounded back after clicking on Cancel button");
}
有很多选择...