Android Espresso FlakyTest 注释 - 如何过滤执行测试?

Android Espresso FlakyTest annotation - how to filter tests on execution?

根据我从这些 docs 中读到的内容,我们可以注释任何易碎测试,然后应该有一种方法可以过滤掉它们,运行 他们 alone.I 认为 firebase robo 测试将了解这一点并仅重新测试片状的,但以下陈述让我感到困惑:

Can then be used to filter tests on execution using -e annotation or -e notAnnotation as desired.

这个开关 -e 是什么?我如何过滤测试?该评论使我对如何对执行进行拟合测试感到困惑。是在 gradle 命令行上完成的吗?我可以举个例子吗?

在此处输入代码我终于找到了如何执行此操作。当您在测试方法上放置注释时,您可以 运行 一组具有相同注释的方法。阅读 the docs 我们可以了解如何做到这一点。因此,如果我要将许多测试标记为@FlakyTest,那么我可以 运行 所有带有 adb 的 FlakyTest,如下所示:

adb shell am instrument -w -e annotation android.support.test.filters.FlakyTest

这是 AndroidJUnitRunner 文档的一部分,对此进行了解释:

Filter test run to tests with given annotation: adb shell am instrument -w -e annotation com.android.foo.MyAnnotation com.android.foo/android.support.test.runner.AndroidJUnitRunner