Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
630 views
in Technique[技术] by (71.8m points)

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

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.

enter image description here

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:gitPOS>

Does anyone know how to get it work?

Any help is appreciated.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...