Running a specific instrumentation unit test with Gradle

后端 未结 8 947
既然无缘
既然无缘 2020-11-30 04:27

Is there a way to run a specific Android instrumentation unit test using Gradle? I\'ve tried

gradle -Dtest.single=UnitTestName connectedInstrumentTest
         


        
8条回答
  •  臣服心动
    2020-11-30 05:19

    Since Android gradle plugin 1.1.0-rc1, one can run single test class using --tests flag by executing:

    ./gradlew app:testDebug --tests=com.example.MyTest
    

    See http://tools.android.com/tech-docs/unit-testing-support#TOC-Running-from-Gradle

提交回复
热议问题