Sea*_*Shi 3 instrumentation android firebase android-espresso gcloud
我有一个像这样的浓缩咖啡测试套件类
package instrumentedtest;
import org.junit.ClassRule;
import org.junit.rules.ExternalResource;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({
Test1.class,
Test2.class,
Test3.class
})
public class POSRuleSuite {
@ClassRule
public static ExternalResource testRule = new ExternalResource() {
@Override
protected void before() throws Throwable {
System.out.println("Testing starts.........");
}
@Override
protected void after() {
System.out.println("Testing ends.........");
}
};
}
Run Code Online (Sandbox Code Playgroud)
我在 Android Studio 中使用此套件类设置了 Firebase 测试。我从 Android Studio 启动了这个 firebase 测试,它确实有效。
但是当我使用 Gcloud 命令从命令行启动它时,我未能执行测试。
gcloud firebase test android run ^
--type instrumentation ^
--app POS.apk ^
--test POS-debug-androidTest.apk ^
--test-runner-class=org.junit.runners.Suite ^
--test-targets=instrumentedtest.POSRuleSuite ^
--device model=Nexus10,version=22,locale=en,orientation=landscape ^
--timeout 300s
Run Code Online (Sandbox Code Playgroud)
这是输出
Uploading [POS.apk] to Firebase Test Lab...
Uploading [POS-debug-androidTest.apk] to Firebase Test Lab...
Raw results will be stored in your GCS bucket at [https://console.developers.google.com/storage/browser/test-lab-j9zwyqscmy0rw-k53tazzivjxvu/2017-10-19_14:25:20.055000_jPmA/]
ERROR: (gcloud.firebase.test.android.run) Http error while creating test matrix: ResponseError 400: Invalid test target for instrumentation test: instrumentedtest.POSRuleSuite
C:\git\POS>
Run Code Online (Sandbox Code Playgroud)
有谁知道如何让它工作?
任何帮助表示赞赏。
我找到了原因,我们必须告知test-targets的类型。在这种情况下,类型是class。所以这条线应该是这样的。
--test-targets="class instrumentedtest.POSRuleSuite"
Run Code Online (Sandbox Code Playgroud)
您还可以传递包含所有目标的字符串列表,以逗号分隔,例如:
--test-targets="class instrumentedtest.POSRuleSuite,class instrumentedtest.AnotherRuleSuite"
Run Code Online (Sandbox Code Playgroud)
这里是完整的请求。
gcloud firebase test android run ^
--type instrumentation ^
--app POS.apk ^
--test POS-debug-androidTest.apk ^
--test-targets="class instrumentedtest.POSRuleSuite" ^
--device model=Nexus10,version=22,locale=en,orientation=landscape ^
--timeout 300s
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1025 次 |
| 最近记录: |