简体   繁体   English

Firebase 测试实验室对按大小注释的测试方法进行插桩测试

[英]Firebase Test Lab instrumented test for test method annotated by size

In my project I am using the following commands to generate my app APK and instrumented test APK.在我的项目中,我使用以下命令来生成我的应用 APK 和插桩测试 APK。

./gradlew :app:assembleDebug
./gradlew :app:assembleDebugAndroidTest

Using the generated files I am triggering a test in Test Lab using gcloud, which works without problems.使用生成的文件,我正在使用 gcloud 在测试实验室中触发测试,它可以正常工作。

Now, I want to have annotations for the test size (small, medium, large), so only a subset of tests can be triggered in Test Lab, based on the test annotations.现在,我想为测试大小(小、中、大)添加注释,因此根据测试注释,只能在测试实验室中触发一部分测试。

Can it be done or is there a different approach to handle it?它可以完成还是有不同的方法来处理它?

Yes, by using the --test-targets flag.是的,通过使用--test-targets标志。 It supports the same options as the -e flag for AndroidJUnitRunner .它支持与AndroidJUnitRunner-e标志相同的选项。

If you use the SmallTest , MediumTest , LargeTest annotations from android.support.test.filters package you can eg only run the small test the following way:如果您使用android.support.test.filters包中的SmallTestMediumTestLargeTest注释,您可以仅以以下方式运行小型测试:

gcloud firebase test android run --test-targets "size small" <your other flags>

Custom annotations are supported too:也支持自定义注释:

gcloud firebase test android run --test-targets "annotation com.example.MyAnnotation

For more options, take a look at the gcloud documentation for this command .有关更多选项,请查看此命令gcloud 文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM