How to execute a designated test suite class in Firebase Test Lab

为君一笑 提交于 2019-12-20 04:53:04

问题


I have an espresso test suite class like this

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.........");
        }
    };
}

I set up a Firebase test with this suite class in Android Studio. I launch this firebase test from Android Studio and it does work.

But I failed to execute the test when I launch it from command line with Gcloud command.

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

Here is output

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>

Does anyone know how to get it work?

Any help is appreciated.


回答1:


I found the reason. I should use this one.

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


来源:https://stackoverflow.com/questions/46838659/how-to-execute-a-designated-test-suite-class-in-firebase-test-lab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!