Running a specific instrumentation unit test with Gradle

后端 未结 8 946
既然无缘
既然无缘 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:12

    You should not forget to specify a build variant name after test property declaration like

    -Dtest=.

    Like if you have a debug build type which gives you debug variant after compilation, then if you want to run a test only for this build variant you should declare a command like this:

    ./gradlew -DtestDebug=UnitTestName testDebug

提交回复
热议问题