Android版的TestSuite:包括除了一些明确定义的TestCase的所有 [英] Android TestSuite: Include all TestCases except some explicitly defined

查看:287
本文介绍了Android版的TestSuite:包括除了一些明确定义的TestCase的所有的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题:我需要适应从<一的code href=\"http://developer.android.com/resources/samples/ApiDemos/tests/src/com/example/android/apis/AllTests.html\"相对=nofollow> Android开发者的TestSuite例如,以便它运行除了少数明确定义那些包中的所有的TestCase。目前,它只是运行这些:

Problem: I need to adapt the code from the Android Developer TestSuite example so that it runs all TestCases in the package except a few explicitly defined ones. Currently it just runs them all:

public class AllTests extends TestSuite {
    public static Test suite() {
        return new TestSuiteBuilder(AllTests.class)
                .includeAllPackagesUnderHere()
                .build();
    }
}

纵观文档为TestSuiteBuilder ,也许我可以通过向TestSuiteBuilder的addRequirements()的调用方法适应上述code,但我不能让元首或这是否会做到这一点,还是应该用来做什么的尾巴。

Looking at the Docs for TestSuiteBuilder, perhaps I could adapt the above code by adding a call to TestSuiteBuilder's addRequirements() method, but I can't make heads or tails of if this will do it, or should be used to do it.

如果addRequirements会,应该用来排除AndroidTestCases,我怎么称呼呢?我不明白,我会通过什么样的说法,该文件说:

If addRequirements will and should be used to exclude AndroidTestCases, how do I call it? I don't understand what argument I'd pass, the documentation says:

addRequirements(Predicate...<TestMethod> predicates)
//Exclude tests that fail to satisfy all of the given predicates. 

但我不能找到一个类 predicate 或应该如何填充来实现我的目标存在任何事情。

But I can't find anything about the existence of a class Predicate or how it should be populated to achieve my goal.

感谢

推荐答案

有是禁用/忽略的测试方式。

There is a way to disable/ignore tests.

请参阅此链接

<一个href=\"http://veerasundar.com/blog/2009/07/junit-4-testing-for-exception-execution-time-and-disabling-a-test/\" rel=\"nofollow\">http://veerasundar.com/blog/2009/07/junit-4-testing-for-exception-execution-time-and-disabling-a-test/

这篇关于Android版的TestSuite:包括除了一些明确定义的TestCase的所有的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆