首页 > 其他 > 详细

Junit中AssertTrue的使用

时间:2017-02-03 19:29:02      阅读:235      评论:0      收藏:0      [点我收藏+]

assertTrue

public static void assertTrue(String message,
                              boolean condition)
Asserts that a condition is true. If it isn‘t it throws an AssertionError with the given message.

分析:

示例:

boolean value=webDriver.findElement(By.xpath("......")).isDisplay();//判断是否显示xx

assertTrue("Failed to go to the Login page", value);

如果value的值是true则运行成功,如果value的值是false则运行失败并打印出信息“Failed to go to the Login page”。

Parameters:
message - the identifying message for the AssertionError (null okay)
condition - condition to be checked

assertTrue

public static void assertTrue(boolean condition)
Asserts that a condition is true. If it isn‘t it throws an AssertionError without a message.

 

Parameters:
condition - condition to be checked

Junit中AssertTrue的使用

原文:http://www.cnblogs.com/woniu123/p/6363211.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!