如何在Firebase测试实验室中执行指定的测试 [英] How to execute a designated test in Firebase Test Lab
问题描述
我想使用gcloud firebase test android run
从一个测试套件中运行一个测试,但是我无法弄清楚语法.
I want to run one test from one test suite using gcloud firebase test android run
but I can't figure out the syntax.
此命令失败:
gcloud firebase test android run \
--type instrumentation \
--project locuslabs-android-sdk \
--app app/build/outputs/apk/debug/app-debug.apk \
--test app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk \
--device model=Pixel2,version=27,locale=en_US,orientation=portrait \
--verbosity debug \
--test-targets "class com.example.firebasetestlabplayground.ExampleInstrumentedTest.test002"
错误消息:
java.lang.ClassNotFoundException: com.example.firebasetestlabplayground.ExampleInstrumentedTest.test002
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:453)
at android.support.test.internal.runner.TestLoader.doCreateRunner(TestLoader.java:72)
at android.support.test.internal.runner.TestLoader.getRunnersFor(TestLoader.java:104)
at android.support.test.internal.runner.TestRequestBuilder.build(TestRequestBuilder.java:789)
at android.support.test.runner.AndroidJUnitRunner.buildRequest(AndroidJUnitRunner.java:539)
at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:382)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2075)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.firebasetestlabplayground.ExampleInstrumentedTest.test002" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/data/app/com.example.firebasetestlabplayground.test-F71g9fZiJ95s1aLuzIJRsw==/base.apk", zip file "/data/app/com.example.firebasetestlabplayground-EuQG5YDD3hrz6BPtBz2t6g==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.firebasetestlabplayground.test-F71g9fZiJ95s1aLuzIJRsw==/lib/x86, /data/app/com.example.firebasetestlabplayground-EuQG5YDD3hrz6BPtBz2t6g==/lib/x86, /system/lib, /system/vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 8 more
In my research, I came across How to execute a designated test suite class in Firebase Test Lab which was very helpful in getting me this far but it doesn't specify how to run a single test within the suite.
此外,根据> https://github.com/piotrmadry/FirebaseTestLab-Android/issues/11 ,应该可以使用--test-targets
参数运行单个测试,但是文档未在
Also, according to https://github.com/piotrmadry/FirebaseTestLab-Android/issues/11, it should be possible to run a single test with the --test-targets
parameter, but the documentation doesn't give an example at https://cloud.google.com/sdk/gcloud/reference/firebase/test/android/run#--test-targets.
推荐答案
Michael,在 AndroidJUnitRunner 还介绍了完整的语法.
Michael, that syntax using # is documented in the gcloud command reference (or add --help to your command above to get docs from the command line). That gcloud documentation in turn links to the full documentation for the AndroidJUnitRunner which also describes the full syntax.
这篇关于如何在Firebase测试实验室中执行指定的测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!