Running a specific instrumentation unit test with Gradle

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

    You gotta check this out.

    https://github.com/JCAndKSolutions/android-unit-test

    I made an issue in this github repository, and this guy solved my problem and upload to maven, so in my build.gradle file I use this plugin.

    Instructions are written in his repository. you can easily follow it.

    After using this android-unit-test plugin, I can use like

    ../gradlew -Dtest.single=SomeTest test 
    

    or

    ../gradlew -Dtest.single=SomeTest clean check
    

    Now it's working and I could only run the specific tests I want to

提交回复
热议问题