I searched a lot, but, unfortunately, could not get it to work.
Based on my search, I found that I need to add the following code to the build.gradle file. However, Gradle does not seem to recognize it and always says Geadle DSL method not found: test()
test { testLogging.showStandardStreams = true testLogging.events("passed", "skipped", "failed", "standardOut", "standardError") afterTest { desc, result -> println "Executing test ${desc.name} [${desc.className}] with result: ${result.resultType}" } }
Update
I can confirm the above code or better than the following code works fine if you create a test project and move all your test cases inside it instead of src/test/java and src/androidTest/java in the main project. This is because you can use the java plugin in the build.gradle file. However, it is not possible to use the following code in any build.gradle file that was defined by com.android.* . Since these two libraries are incompatible: (
apply plugin: 'java' evaluationDependsOn(':YOUR-LIB') test { testLogging.showStandardStreams = true testLogging { events "passed", "skipped", "failed", "standardOut", "standardError" exceptionFormat = 'full' } afterTest { desc, result -> println "Executing test ${desc.name} [${desc.className}] with result: ${result.resultType}" } forkEvery = 5 maxParallelForks = java.lang.Runtime.runtime.availableProcessors() / 2 } tasks.withType(Test) { // Need Gradle to ignore classes that are inner class of Test classes but not actually Tests scanForTestClasses = false include "**/*Test.class" }
So my question is, will anyone PICTURE any way to print logs under the android plugin?
source share