首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >测试程序样本

测试程序样本
EN

Stack Overflow用户
提问于 2018-12-02 04:01:27
回答 1查看 1.3K关注 0票数 1

是否有人知道一个示例项目显示如何使测试计划工作?我检查了谷歌的样本,似乎没有一个很好的示例项目显示测试计划。

https://github.com/googlesamples/android-testing

我一直试图让android测试在测试程序中运行,但一直在努力让它正常工作。我尝试通过Android (最新的3.2.1)和命令行(https://developer.android.com/training/testing/junit-runner#ato-command-line)运行测试。我参考了Android开发人员的文档。

https://developer.android.com/training/testing/junit-runner

以下是我遵循的步骤。

代码语言:javascript
复制
1) Create an empty activity application using the wizard in Android 
Studio 
2) Enable the test orchestrator using the steps provided here 
(https://developer.android.com/training/testing/junit-runner).
3) Run the unit tests from within the IDE and from the command line.

当我这样做时,我会得到一个错误,指示我的“测试套件是空的”。我在命令行中运行同样的错误。

注意,如果我在没有测试协调器的情况下运行测试,那么测试将成功运行。

还请注意,我使用的是最新的测试编排版本。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-04-01 18:24:38

要运行测试调度器的完整配置:

  1. 添加依赖项: "androidx.test:orchestrator:$testOrchestrator“androidTestImplementation "androidx.test:runner:$testRunner”androidTestUtil androidTestUtil
  2. 添加清晰的包指令(在app的defaultConfig中的build.gradle中): //允许以孤立的方式运行所有测试。如果我们需要调试一个测试,应该禁用这个和testInstrumentationRunnerArguments clearPackageData:'true‘
  3. 添加到testOptions Android/AndroidX orchestrator: testOptions {执行'ANDROIDX_TEST_ORCHESTRATOR‘}
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53577274

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档