【问题标题】:Robotium + Robolectric机器人 + Robolectric
【发布时间】:2015-08-03 13:17:12
【问题描述】:

我正在使用这两个框架来测试我的应用程序。

我知道要运行这些命令:

仪器:gradlew clean connectedAndroidTest 机器人:gradlew clean build

我尝试过其他人,但这些是我认为的要点。

是否有任何命令可以运行这两个测试?

【问题讨论】:

  • 你试过 ./gradlew clean build connectedAndroidTest 吗?
  • 不,但我会试试看 :)(好主意)

标签: android unit-testing testing robotium robolectric


【解决方案1】:

您可以使用此命令运行所有测试:

adb shell am instrument -w com.android.foo/android.test.InstrumentationTestRunner

或者这个运行单个测试用例:

adb shell am instrument -w -e class com.android.foo.FooTest com.android.foo/android.test.InstrumentationTestRunner

更多使用方法在这里link

这是我如何使用此命令的示例

adb shell am instrument -w  -e class app.name.androidTest.TestCustomer mobile.touch.core.test/android.test.InstrumentationTestRunner

很好,因为它立即运行测试

另一种方法是实现 spoon-gradle-plugin Spoon 插件非常适合运行测试和生成报告。

用勺子运行测试的命令:

gradle spoon -PspoonClassName=fully.qualified.TestCase

【讨论】:

    猜你喜欢
    • 2011-07-23
    • 2018-06-05
    • 2020-08-20
    • 2012-01-20
    • 2012-08-16
    • 1970-01-01
    • 1970-01-01
    • 2017-08-18
    • 1970-01-01
    相关资源
    最近更新 更多