我怎样才能 运行 '@SmallTest' 和 '@MediumTest' 而不是 '@LargeTest'?
How can I run both '@SmallTest' and '@MediumTest' and not '@LargeTest'?
详情:
我希望能够 运行 所有 @SmallTest
和 @MediumTest
测试,同时忽略 @LargeTest
测试。
看起来Android ADB 检测命令支持否定。例如,您可以否定 annotation
,例如 notAnnotation
,但我没有看到 size
的 notSize
。
理想情况下,最好有类似的东西:adb shell am instrument -w -e notSize large com.android.foo/android.support.test.runner.AndroidJUnitRunner
。
我宁愿不创建自定义注释然后被迫重新注释我的所有测试。
我试过以下方法:
- 尝试过
notSize
:
adb shell am instrument -w -e notSize large com.android.foo/android.support.test.runner.AndroidJUnitRunner
- 2
size
参数:
adb shell am instrument -w -e size small -e size medium com.android.foo.MyAnnotation com.android.foo/android.support.test.runner.AndroidJUnitRunner
参考资料
- What is the purpose of @SmallTest, @MediumTest, and @LargeTest annotations in Android?
- https://developer.android.com/reference/android/test/InstrumentationTestRunner.html
- https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner.html
使用 notAnnotation
并指定 LargeTest
的完全限定路径:
adb shell am instrument -w -e notAnnotation android.support.test.filters.LargeTest com.android.foo/android.support.test.runner.AndroidJUnitRunner
详情:
我希望能够 运行 所有 @SmallTest
和 @MediumTest
测试,同时忽略 @LargeTest
测试。
看起来Android ADB 检测命令支持否定。例如,您可以否定 annotation
,例如 notAnnotation
,但我没有看到 size
的 notSize
。
理想情况下,最好有类似的东西:adb shell am instrument -w -e notSize large com.android.foo/android.support.test.runner.AndroidJUnitRunner
。
我宁愿不创建自定义注释然后被迫重新注释我的所有测试。
我试过以下方法:
- 尝试过
notSize
:adb shell am instrument -w -e notSize large com.android.foo/android.support.test.runner.AndroidJUnitRunner
- 2
size
参数:adb shell am instrument -w -e size small -e size medium com.android.foo.MyAnnotation com.android.foo/android.support.test.runner.AndroidJUnitRunner
参考资料
- What is the purpose of @SmallTest, @MediumTest, and @LargeTest annotations in Android?
- https://developer.android.com/reference/android/test/InstrumentationTestRunner.html
- https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner.html
使用 notAnnotation
并指定 LargeTest
的完全限定路径:
adb shell am instrument -w -e notAnnotation android.support.test.filters.LargeTest com.android.foo/android.support.test.runner.AndroidJUnitRunner