问题:我需要修改Android Developer TestSuite example中的代码,以便运行包中的所有测试用例,除了一些明确定义的测试用例。目前,它只是运行他们都:Android TestSuite:包括除明确定义的所有测试用例外
public class AllTests extends TestSuite {
public static Test suite() {
return new TestSuiteBuilder(AllTests.class)
.includeAllPackagesUnderHere()
.build();
}
}
望着Docs for TestSuiteBuilder,也许我可以通过增加TestSuiteBuilder的addRequirements()的调用方法适应上面的代码,但我不能让元首或如果这能尾巴做它,或者应该被用来做它。
如果addRequirements将会被用来排除AndroidTestCases,我该如何调用它?我不明白,我会通过什么样的说法,该文件说:
addRequirements(Predicate...<TestMethod> predicates)
//Exclude tests that fail to satisfy all of the given predicates.
但我不能找到一个类Predicate
的存在或应该如何填充达到我的目的什么。
感谢
谢谢!不幸的是,虽然Eclipse不喜欢@Ignore或@Test标签,但它说“无法解析为类型”? – Jodes 2011-05-18 08:39:42
嗯......我正在使用它们,并没有遇到问题......我甚至能够搜索引用。 – Kichu 2011-05-19 04:48:20
由于Android仅支持Junit3,因此无法如此清楚地说明:“请注意,Android测试API支持JUnit 3代码风格,但不支持JUnit 4.” http://developer.android.com/guide/topics/testing/testing_android.html#JUnit – Maks 2012-04-04 02:53:25