如何将Android Espresso测试分为不同的APK [英] How to split Android Espresso tests into different APKs

查看:72
本文介绍了如何将Android Espresso测试分为不同的APK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Espresso Android测试APK,其中包含许多测试(约70个),我想将测试分为多个APK,然后分别在Firebase测试实验室中运行它们. 在Android Studio框架内,我创建了多个测试套件.但是,当我需要生成包含较少测试的APK时,我会创建项目的多个副本,然后我将进行测试,并使用所需的测试生成APK.

I have a Espresso Android test APK with a lot of tests (about 70), and I wanted to split the tests into different APKs and then run them, separately, on Firebase Test Lab. Within the Android Studio framework, I created several Test Suites. However, when I need to generate an APK with fewer tests, I create several copies of the project and I will take tests and generate the APKs with the tests I need.

我的问题是:

  • 是否有任何方法可以拆分测试APK,而不必总是执行先前的过程? 也就是说,是否有任何机制可以生成APK并指定要在APK中包含哪些测试(或多少测试)?
  • Is there any way to split the test APK without always having to do the previous process? That is, are there any mechanisms for generating the APK and specifying which tests (or how many tests) I want to include in my APK?

非常感谢, xptoGirl

Many thanks, xptoGirl

推荐答案

最简单的方法是使用

The easiest way doing this is with gcloud --test-targets. This way you do not have to split up your test APK. Rather you create multiple test runs in Test Lab but with different packages, annotations or classes that you want to test.

例如只在特定的子程序包中运行测试:

E.g. to only run tests in specific sub-packages:

gcloud firebase test android run \
  --app path/to/app.apk \
  --test path/to/tests.apk \
  --device model=walleye,version=26  \
  --test-targets "package com.my.package.tests1","package com.my.package.tests2"

这篇关于如何将Android Espresso测试分为不同的APK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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