Ignoring a Test
如果我们不想让某个测试失败,我们仅仅想要忽略它,那么我们可以暂时的disable它。
有三种方法来忽略一个测试:
- 把方法注释掉
- 删除 @Test 注释
- 增加 @Ignore注释: @Ignore([ignore reason])
方法一和方法二会导致测试结果不包括该测试。而使用方法三的话,执行完测试之后,我们不仅会知道跑多少测试,失败多少测试,还会知道有多少测试被忽略了。通过在@Ignore内添加字符串参数我们还可以记录该测试被忽略的原因。
import static org.junit.Assert.assertArrayEquals;
import org.junit.Ignore;
import org.junit.Test; public class IgnoreTest { @Ignore("testAssertArrayEquals ignore")
@Test
public void testAssertArrayEquals(){
byte[] expected="trial".getBytes();
byte[] actual="trial".getBytes();
assertArrayEquals("failure-byte arrays not same",expected, actual);
}
}
测试结果:
Runs:1/1(1 skipped) Errors:0 Failures:0
Ignoring a Test的更多相关文章
- Mysql错误:Ignoring query to other database解决方法
Mysql错误:Ignoring query to other database解决方法 今天登陆mysql show databases出现Ignoring query to other datab ...
- 【小错误】Device eth2 has different MAC address than expected, ignoring.
今天在搭建rac配置IP的时候报错显示如下: Device eth2 has different MAC address than expected, ignoring.[FAILED] 百度了下,问 ...
- 论文笔记之:Speed Up Tracking by Ignoring Features
Speed Up Tracking by Ignoring Features CVPR 2014 Abstract:本文提出一种特征选择的算法,来实现用最"精简"的特征以进行目标跟 ...
- Android编译错误, Ignoring InnerClasses attribute for an anonymous inner class
今天在做android项目时,加入第三方包,一编译就报错.错误如下:[2012-01-13 14:51:25 - xxx] Dx warning: Ignoring InnerClasses attr ...
- A session had already been started - ignoring session_start() 解决方法
A session had already been started - ignoring session_start() --已经存在一个session 打开了 -- 忽略sessioon_star ...
- 【ZBar】ios错误ignoring file xxx missing required architecture x86_64 in file
解决方法: 1.在Project target里"Architectures"设置为:Standard (armv7,armv7s)或者 Standard (armv7,arm6 ...
- Ignoring HTTPS certificates
Our Development setups won't have valid or trusted certificates. When do you want test our webserver ...
- hadoop错误Ignoring exception during close for org.apache.hadoop.mapred.MapTask$NewOutputCollector@17bda0f2 java.io.IOException Spill failed
1.错误 Ignoring exception during close for org.apache.hadoop.mapred.MapTask$NewOutputCollector@17bd ...
- 解决Undefined symbols for architecture x86_64: 报错 和 ld: warning: ld: warning: ignoring file警告
出现这种错误的情况: 用iphone5模拟器编译程序正常, 用iphone5s以上的模拟器编译出现Undefined symbols for architecture x86_64: 报错 和 ld: ...
- coreseek(sphinx)错误:WARNING: attribute 'id' not found - IGNORING
coreseek(sphinx)错误:WARNING: attribute 'id' not found - IGNORING原因及解决方法 coreseek(sphinx)建立索引时提示错误: WA ...
随机推荐
- C#中Dictionary、ArrayList、Hashtable和Array的区别
IDictionary接口是所有字典类集合的基本接口,该接口与ICollection,IEnumerable接口是所有非泛型类集合的最基本的接口 IEnumerable接口用于公开枚举数,该枚举数支持 ...
- (java)从零开始之-反射Reflect
反射: 当一个字节码文件加载到内存的时候,jvm会对该字节码进行解剖,然后会创建一个对象的Class对象,把字节码文件的信息全部都存储到该Class对象中,我们只要获取到Class对象,我们就可以使用 ...
- (java)从零开始之--异常处理(以文件拷贝为例)
开发过程中避免不了对异常的处理,但是异常的处理又不能乱throw 下面是简单的抛异常处理 public static void CopyFile(String souFile,String dirFi ...
- POJ 1734.Sightseeing trip (Floyd 最小环)
Floyd 最小环模板题 code /* floyd最小环,记录路径,时间复杂度O(n^3) 不能处理负环 */ #include <iostream> #include <cstr ...
- 常见ORACLE错误,及解决方案(遇则即时更新)
1.当登陆时提示“ORA-03113:通信通道的文件结束”时: 解决方案: 需在X:\oraclexe\app\oracle\product\10 ...
- Float之谜
先来看几个例子: public class Thirtyfirst1{ public static void main(String[] args){ int i = 2000000000; int ...
- seaJs初体验
目录结构 模块定义define define(function(require,exports,module){ //exports可以把方法或属性暴露给外部 exports.name = 'hell ...
- Windows7 IIS7 无法启动计算机上的服务W3SVC如何修复
错误提示 启动iis7管理服务器提示:无法启动计算机上的服务W3SVC 启动Windows Process Activation Service服务,报错:6801 指定资源管理器中的事务支持未启动或 ...
- JS获取IP
新浪的IP地址查询接口:http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js新浪多地域测试方法:http://int.dpool.s ...
- redis 服务器端命令
redis 127.0.0.1:6380> time ,显示服务器时间, 时间戳(秒), 微秒数 1) "1375270361" 2) "504511" ...