Junit中AssertTrue的使用
assertTrue
public static void assertTrue(String message,
boolean condition)
- Asserts that a condition is true. If it isn't it throws an
AssertionErrorwith 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 theAssertionError(nullokay)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
AssertionErrorwithout a message. -
- Parameters:
condition- condition to be checked
Junit中AssertTrue的使用的更多相关文章
- junit中的assert方法总结
junit中的assert方法全部放在Assert类中,总结一下junit类中assert方法的分类.1.assertTrue/False([String message,]boolean condi ...
- JUnit中Assert简单介绍
junit中的assert方法全部放在Assert类中,总结一下junit类中assert方法的分类.1.assertTrue/False([String message,]boolean condi ...
- 关于Junit中Assert已经过时
在junit4.12之后,Assert就过时了,提供了TestCase来取代: 同样在TestCase中原本比较常见的一些方法也已经取消了,例如:assertNotEquals.assertThat. ...
- JUnit中测试异常抛出的方法
最近在做TWU关于TDD的作业,对JUnit中测试异常抛出的方法进行了一些学习和思考. 在进行单元测试的时候有的时候需要测试某一方法是否抛出了正确的异常.例如,我有一个方法,里面对一个List进行读取 ...
- Junit中常用的注解说明
Java注解((Annotation)的使用方法是@注解名 ,能通过简单的词语来实现一些功能.在junit中常用的注解有@Test.@Ignore.@BeforeClass.@AfterClass.@ ...
- 为什么多线程、junit 中无法使用spring 依赖注入?
为什么多线程.junit 中无法使用spring 依赖注入? 这个问题,其实体现了,我们对spring已依赖太深,以至于不想自己写实例了. 那么到底是为什么在多线程和junit单元测试中不能使用依赖注 ...
- try....fail....catch...Assert 模式的测试, fail是Junit中的功能
try { // 反射读取properties文件 new BufferedReader(new FileReader(myConfigPath[4])); //上面没有抛出异常就是执行fail, / ...
- junit中test注解测试使用案列解析二
本文原创,转载请注明出处 在上文中,已经简单的解析了junit中test注解的使用方法,今天在进行test测试时,遇到了一个异常,于是想深 入的研究一下. 还原一下今天的异常代码: @Service ...
- 解释JUnit中@BeforeClass和@AfterClass标注的方法必须是static的,而在TestNg不必
在JUnit中@BeforeClass和@AfterClass标注的方法必须是static的:但是在TestNg中却没有这样的限制,这是为什么呢. 其实和他们两的运行机制有关. 在junit中: 每运 ...
随机推荐
- php背景图片上生成二维码,二维码上带logo 代码示例 (原)
依赖库文件 phpqrcode.php (下载地址://www.jb51.net/codes/189897.html :或者在官网下载:http://phpqrcode.sourceforge.net ...
- 强力上攻后,缓解期结束,MACD死叉的案例
eg1.顶部,MACD收紧,缓解期刚过,正好下M5,触发减仓条件
- windows Server2012 IIS8.0配置安装完整教程
IIS8.0是windows Server2012自带的服务器管理系统,和以往不同,IIS8.0安装和操作都比较简单,界面很简洁,安装也很迅速.今天我们重点完整的演示下Internet Informa ...
- jQuery-切换事件2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- Unity shader学习之Forward Rendering Path
Forward rendering path shader如下: // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObje ...
- RRDtool 安装和使用
一.RRDtool 的功能及使用介绍 定义:RRDtool(Round Robin Database Tool)是一个用来处理定量数据的开源高性能数据库. 1.RRDtool 的特性 由于 RRDto ...
- Necklace of Beads (polya定理的引用)
Beads of red, blue or green colors are connected together into a circular necklace of n beads ( n &l ...
- Nginx技术研究系列2-基于Redis实现动态路由
上篇博文我们写了个引子: Ngnix技术研究系列1-通过应用场景看Nginx的反向代理 发现了新大陆,OpenResty OpenResty 是一个基于 Nginx 与 Lua 的高性能 Web 平台 ...
- 【Linux学习一】命令查看与帮助
环境 虚拟机:VMware 10 Linux版本:CentOS-6.5-x86_64 客户端:Xshell4 FTP:Xftp4 一.Linux执行命令流程:shell->bash(解释器 执行 ...
- SQL提交数据三种类型
在数据库的插入.删除和修改操作时,只有当事务在提交到数据库时才算完成. SQL语句提交数据有三种类型:显式提交.隐式提交及自动提交. [1]显式提交 显式提交.即用COMMIT命令直接完成的提交方式. ...