简体   繁体   English

如何将 Android Espresso 测试拆分为不同的 APK

[英]How to split Android Espresso tests into different APKs

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.我有一个带有大量测试(大约 70 个)的 Espresso Android 测试 APK,我想将测试拆分为不同的 APK,然后在 Firebase 测试实验室上分别运行它们。 Within the Android Studio framework, I created several Test Suites.在 Android Studio 框架中,我创建了几个测试套件。 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。

My question is:我的问题是:

  • Is there any way to split the test APK without always having to do the previous process?有什么方法可以拆分测试 APK 而不必总是执行前面的过程? 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?也就是说,是否有任何机制可以生成 APK 并指定我想在我的 APK 中包含哪些测试(或多少个测试)?

Many thanks, xptoGirl非常感谢, xptoGirl

The easiest way doing this is with gcloud --test-targets .最简单的方法是使用gcloud --test-targets This way you do not have to split up your test APK.这样您就不必拆分测试 APK。 Rather you create multiple test runs in Test Lab but with different packages, annotations or classes that you want to test.而是在测试实验室中创建多个测试运行,但使用不同的包、注释或要测试的类。

Eg 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"

暂无
暂无

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

相关问题 如何从谷歌 Firebase 获取代码覆盖率报告以进行 Android Espresso 测试 - How to get code coverage reports from google Firebase for Android Espresso tests 如何在Firebase测试实验室中并行运行Espresso工具测试? - How to run Espresso instrumentation tests in parallel in Firebase Test Lab? 使用Android的Test Lab运行Espresso测试时触发矩阵测试时出错 - Error triggering a matrix tests when I run my Espresso tests using Test Lab for Android 如何在同一套件下的Android Studio中发布两个APK? - How can I release two apks in android studio under a same package? 在Firebase上运行Espresso测试时出现NoClassDefFoundError - NoClassDefFoundError when running Espresso tests on Firebase 如何在Android Studio上使用独立的Android应用程序(.apk文件)执行Firebase Robo测试记录(espresso)? - How to perform firebase robo test recording (espresso) with standalone android app (.apk file) on android studio? 如何从CLI测试后获取gcloud Firebase测试实验室Android Espresso结果? - How to fetch gcloud Firebase test lab Android Espresso results after testing from CLI? 如何在 Android Firebase Kotlin 上运行单元测试? - How to run unit tests on Android Firebase Kotlin? java.lang.NoSuchMethodError:没有 static 方法 registerDefaultInstance 和 Firebase 性能和 Espresso 仪器测试 - java.lang.NoSuchMethodError: No static method registerDefaultInstance with Firebase Performance and Espresso Instrumented Tests Android espresso 测试在本地通过,但在 Firebase 测试实验室失败 - Android espresso test pass locally but fails on Firebase Test Lab
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM