Gradle Android: How to Display test results without using --info

前端 未结 3 1089
梦谈多话
梦谈多话 2021-02-15 12:59

I am running android tests using the Gradle Android plugin and want to see individual test results.

From answers to this Question Gradle: How to Display Test Results in

3条回答
  •  囚心锁ツ
    2021-02-15 13:13

    For Android Studio (tested on com.android.tools.build:gradle:2.1.0 and gradle version gradle-2.10) I added the following section to print exceptions in full format as well as logging every executed test:

    apply plugin: 'com.android.application'
    
    android { ... }
    
    dependencies { ...}
    
    tasks.withType(Test) {
        testLogging {
            exceptionFormat "full"
        }
        afterTest { desc, result ->
            println "Executing test ${desc.name} [${desc.className}] with result: ${result.resultType}"
        }
    }
    

提交回复
热议问题