0

我创建了一个扩展 android.test.InstrumentationTestRunner 的测试运行器。我正在寻找一种方法来定义一组测试以根据一组配置执行。

我想我可能能够覆盖以下方法来返回我的自定义测试套件,但是,这些都没有被调用!只是想知道这些有什么用:

公共测试套件 getAllTests () 公共测试套件 getTestSuite ()

有什么线索吗?我可以使用其他任何替代方法在运行时定义自定义测试套件吗?

谢谢

4

1 回答 1

0

我也不知道...另一种解决方案是定义自己的注释并注释要运行的测试。然后,您可以使用以下方法仅运行带有该注释的测试:

使用给定注释过滤测试运行: adb shell am instrument -w -e annotation com.android.foo.MyAnnotation com.android.foo/android.test.InstrumentationTestRunner

如果与其他选项一起使用,生成的测试运行将包含两个选项的并集。例如,“-e size large -e annotation com.android.foo.MyAnnotation”将只运行带有 LargeTest 和“com.android.foo.MyAnnotation”注释的测试。

在没有给定注释的情况下过滤测试运行: adb shell am instrument -w -e notAnnotation com.android.foo.MyAnnotation com.android.foo/android.test.InstrumentationTestRunner

于 2011-03-22T11:03:15.820 回答