unit testing - Gradle DSL method not found: test() -


tried add following code @ end of build.gradle file in android-studio 1.2 (as advised in this post):

test {     testlogging {         events "passed", "skipped", "failed", "standardout", "standarderror"     } } 

but got:

error:(40, 0) gradle dsl method not found: 'test()' possible causes: - project 'xxxxx' may using version of gradle not contain method. - build file may missing gradle plugin. 

what did miss?

the gradle documentation: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.testing.test.html

indicates 'test' task sourced java plugin:

apply plugin: 'java' // adds 'test' task 

this conflicts com.android.application plugin.

solution

i have worked out how this. rather apply logging changes test tasks (which available java plugin) can apply tasks of type 'test' follows:

//test logging tasks.withtype(test) {     testlogging {         events "started", "passed", "skipped", "failed"     } } 

now when run ./gradlew test should these events logged tests processed.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -