断言和硒验证 [英] assert and verify in Selenium
问题描述
有人能解释什么断言和验证之间的差异吧。
Can someone explain what the difference between assert and verify is please.
我知道这意味着验证它检查,如果它的存在,如果它不是测试失败而停止(正确吗?)
I know that verify means it checks if it is there, if it isn't the test fails and stops there (correct?).
因此,没有关于即使它失败断言套利?
So does assert carry on even if it does fail?
我读过的文件,仍然不能让我的头一轮吧。
I've read the documentation and still can't get my head round it.
推荐答案
不,你已经得到它倒退。在Selenium IDE,既 verifyWhatever
和 assertWhatever
命令确定指定条件为真,然后不同的事情发生。在 assertWhatever
命令失败立即如果条件为假的考验。在 verifywhatever
命令允许测试继续,但会导致它结束时,它会失败。因此,如果你的测试需要您检查的几个项目,其中没有一个是present的presence, assertElement present
将失败的第一,而 verifyElement present
将失败报告,所有失踪。
Nope, you've got it backwards. In Selenium IDE, both verifyWhatever
and assertWhatever
commands determine if the specified condition is true, and then different things happen. The assertWhatever
command fails the test immediately if the condition is false. The verifywhatever
command allows the test to continue, but will cause it to fail when it ends. Thus, if your test requires you to check for the presence of several items, none of which are present, assertElementPresent
will fail on the first, while verifyElementPresent
will fail reporting that all are missing.
向下方 verifyWhatever
是,你真的不能后的验证之一发生故障信任任何测试的行为。由于应用程序没有正确响应,你无法知道随后的断言或验证失败是否有效是早期失败的结果的方式。因此,一些人都认为 verifyWhatever
命令是邪恶的。
The down side to verifyWhatever
is that you really can't trust the behavior of any test after one of its verifications fails. Since the application isn't responding correctly, you have no way of knowing whether subsequent assertion or verification failures are valid or are the result of the earlier failures. Thus some of us think verifyWhatever
commands are Evil.
这篇关于断言和硒验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!