selenium java断言,Java Selenium WebDriver代码以实现验证而不是断言

本文探讨了在测试中如何使用TestNG进行断言操作,并指出TestNG并不支持Verify语句。当Assertion失败时,后续测试步骤会被跳过,而Verify失败时,测试会继续执行并记录失败。如果需要使用Verify,建议切换到JUnit框架。对于想要验证应用登录后标题的场景,文章建议使用JUnit的Assert方法。
摘要由CSDN通过智能技术生成

I am not able to understand how to write Java code to implement Verify. I am always seeing the code to implement Assert but not for Verify. I know for Assert, we need to write the code as below:

Assert.assertTrue()

or

Assert.assertEquals() etc.

But what about Verify? I want to verify the title of my application once the user is logged into the application by using verify. How can I do this?

解决方案

You must use the TestNG framework which only supports Assert statements. It doesn't support Verify statements. You can visit the following URL for TestNG Javadoc:

When Assertion fails all test steps after that line of code are skipped

When a “verify” fails, the test will continue executing and logging the failure.

If you want to use Verify statements then you will have to use the Junit framework.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值