JUnit的新版本发布了,它加入了一个Runner:Categories,可以只跑特定分类的测试用例。
例如我们定义了两个分类接口:
public interface FastTests { /* category marker */ }
public interface SlowTests { /* category marker */ }
然后,我们在某些测试方法前用@Category标记指示该测试方法的类别:
public class A {
@Test
public void a() {
fail();
}
@Category(SlowTests.class)
@Test
public void b() {
}
}
@Category({SlowTests.class, FastTests.class})
public class B {
@Test
public void c() {
}
}
最后,我们使用@Runwith来指定使用Categories测试引擎,并且使用@IncludeCategory指定包括跑哪些测试用例,就可以了:
@RunWith(Categories.class)
@IncludeCategory(SlowTests.class)
@SuiteClasses( { A.class, B.class }) // Note that Categories is a kind of Suite
public class SlowTestSuite {
// 会运行 A.b 和 B.c 方法, 但是不会执行 A.a
}
@RunWith(Categories.class)
@IncludeCategory(SlowTests.class)
@ExcludeCategory(FastTests.class)
@SuiteClasses( { A.class, B.class }) // Note that Categories is a kind of Suite
public class SlowTestSuite {
// 会运行 A.b, 但是不会执行 A.a 或 B.c
}
详细参考请参阅官网:
http://kentbeck.github.com/junit/doc/ReleaseNotes4.8.html
分享到:
相关推荐
Junit4.8 API chm Junit4.8 API chm Junit4.8 API chm Junit4.8 API chm Junit4.8 API chm
JUnit4.8.jar JUnit4.jar
本下载为java开发必备测试工具junit.jar包,JUnit是一个Java语言的单元测试框架。它由Kent Beck和Erich Gamma建立,逐渐成为源于Kent Beck的sUnit的xUnit家族中最为成功的一个。 JUnit有它自己的JUnit扩展生态圈。...
junit4.8jar包 最新的!!!,有用的拿去吧,一分也不多么。。。。。。。
单元测试junit
Jnuit单元测试PDF教程+Junit4.8 jar Jnuit单元测试PDF教程+Junit4.8 jar
junit-4.8.jar用来测试java的哦,大家都知道的吧。
是由GOF 之一的Erich Gamma和 Kent Beck 编写的一个开源的单元测试框架,分析JUnit源代码的主要目的是学习其中对设计模式的运用。
spring4+junit4.8 +多线程TheadTool
junit junit-4.7 junit-4.8 junit-4.9 junit-4.10 junit-4.11 junit文档 junitAPI junit源码 junit.jar 包含了junit 5个版本的jar包。各个版面自己感觉差距挺大的,坑到我了,我最后用的4.10,4.9也行,4.11听说不太...
JUNIT.4.8 文档、JAR包和ZIP都在里面了 Java测试之道,让您少走点弯路,希望对您的学习有点帮助
JUnit4.7包及源码 JUnit4.8包 JUnit4.11包及源码,以及JUnit文档
源代码分析的目标JUnit-4.8.2。http://blog.csdn.net/yqj2065/article/details/39839155
在Eclipse中设置查看JUnit源代码所用到的jar。查看:http://blog.csdn.net/xuefeng0707/article/details/9168997
junit/junit/ Maven依赖写法: <groupId>junit <artifactId>junit <version>4.8.2 </dependency>
junit4.8 使用jar包 没有的话会出错。
JUnit 5 = JUnit Platform + JUnit Jupiter + JUnit Vintage,包含依赖包:junit-jupiter-5.5.1.jar,junit-jupiter-engine-5.5.1.jar,junit-jupiter-params-5.5.1.jar,junit-platform-launcher-1.5.1.jar,junit-...
Files contained in junit4-4.8.2.jar: LICENSE.txt META-INF/MANIFEST.MF junit.extensions.ActiveTestSuite.class junit.extensions.RepeatedTest.class junit.extensions.TestDecorator.class junit.extensions...