- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我们将 Robotium 与 android.test.InstrumentationTestRunner
一起用于我们的测试。尽管如此,我们还是想用 Espresso 替换 Robotium,但我们仍然对此有一些疑问,因为我们有一台带有 Jenkins 的机器用于 CI。
Espresso 使用 android.support.test.runner.AndroidJUnitRunner
而 Robotium 使用前面提到的,首先,我们希望能够同时使用这两个测试框架。可能吗?我们如何在 build.gradle
文件中指定它?我们如何配置我们的 jenkins 机器以针对不同的测试框架执行不同的作业?
我知道 Espresso 可以扩展 ActivityInstrumentationTestCase2
,因为我们的 Robotium 测试类也使用从 ActivityInstrumentationTestCase2
扩展的测试运行器,但我们仍然需要解决插桩测试运行器的问题。
最佳答案
在 Android 开发者文档中,AndroidJUnitRunner
取代了旧的 InstrumentationTestRunner
并启用了 JUnit 4 测试。
The
AndroidJUnitRunner
class is aJUnit
test runner that lets you runJUnit 3
orJUnit 4
-style test classes on Android devices, including those using theEspresso
andUI Automator
testing frameworks.The test runner handles loading your test package and the app under test to a device, running your tests, and reporting test results. This class replaces the
InstrumentationTestRunner
class, which only supports JUnit 3 tests.
https://developer.android.com/training/testing/junit-runner.html
我没有找到很多能够运行 Instrumentation Tests 的例子(例如使用 Robotium)。我一直在寻找自己的目的。
文档解释了如何替换 build.gradle
文件中的测试运行器 https://developer.android.com/training/testing/unit-testing/instrumented-unit-tests
关于android - 将 InstrumentationTestRunner 和 AndroidJUnitRunner 与 Robotium 和 Espresso 一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36420344/
我是 Android 的新手,对 Java 有点生疏,来自 .NET 背景。我正在为在 Android 上运行的移动应用程序开发一些测试自动化。 目前,我只是使用 Android 调试桥通过命令行启动
是否可以从应用程序 A 以编程方式调用 InstrumentationTestRunner 以运行应用程序 B 中的所有测试? 是否可以获取结果? 最佳答案 帖子Android: Running te
这个问题在这里已经有了答案: Test run failed: Instrumentation run failed due to 'java.lang.ClassNotFoundException
我在使用 InstrumentationTestRunner 的子类时遇到了另一个问题。 这是子类的代码: package com.jlptquiz.app.tests; /** * */ imp
我在 Eclipse 中有一个单独的测试项目,它已经在命令行和 Eclipse 中成功运行了一段时间。在使用 Jenkins 运行我的测试时,我遇到了标准 InstrumentationTestRun
我要添加parameterized tests to my Android app test suite .在回答我之前的问题时,@dtmilano 建议我实现一个可以将参数传递给我的参数化测试的测试
我有一个 Android 测试项目,我想链接到 Hudson,但我还没有找到将测试结果输出为 XML 而不是文本的方法。有谁知道是否已经有一种简单的方法可以做到这一点? -丹 最佳答案 仅供引用,对于
我们将 Robotium 与 android.test.InstrumentationTestRunner 一起用于我们的测试。尽管如此,我们还是想用 Espresso 替换 Robotium,但我们
这是我的 full code ,当我运行以下代码时, public class KernelTest { @Test public void testM() { ass
我是一名优秀的程序员,十分优秀!