如何在Android Studio 2.3检测测试中添加额外的测试运行器参数

时间:2017-01-02 10:29:56

标签: android android-studio android-studio-2.2 android-studio-2.3

在Android Studio 2.3中,没有允许用户在Edit configuration窗口中为Android Instrumented Tests设置其他测试运行器参数的字段,但此选项在2.2.x版本中存在。

在新的AS中是否有其他方法(从命令行手动运行测试除外)为espresso测试添加额外的运行参数?

修改

我在错误跟踪器上填写了一个问题:

https://code.google.com/p/android/issues/detail?id=231797&q=instrumentation&sort=-opened&colspec=ID%20Status%20Priority%20Owner%20Summary%20Stars%20Reporter%20Opened

1 个答案:

答案 0 :(得分:3)

无法通过该窗口执行此操作,因为它已不存在。

另一种方法是将Test Runner子类化,然后在那里传递params。以下是使用Robolectric的示例:https://www.snip2code.com/Snippet/90320/An-extension-of-RobolectricTestRunner-th