In my Android application, I want exclude some test cases in a package so that I used test
task in build.gradle
file. for example:
apply plugin: 'com.android.library'
test{
exclude '**/calltest/Summary.class'
}
If sync the project I got following exception:
* What went wrong:
A problem occurred evaluating project ':SdkModule'.
> Could not find method test() for arguments [build_4g3vf7b615x3x1p7i9ty0pt1l$_run_closure1@73d026ca] on project ':SdkModule' of type org.gradle.api.Project.
If I add apply plugin : 'java'
CONFIGURE FAILED in 1s
The 'java' plugin has been applied, but it is not compatible with the Android plugins.
Please help me on this.
useJUnitPlatform() Specifies that JUnit Platform should be used to discover and execute the tests.
Got similar problem when try to generate XML test report for my Jenkins build.
Test related settings should be in testOptions
. My file:
android {
testOptions {
unitTests.includeAndroidResources = true
unitTests.all {
reports {
junitXml.enabled = true
html.enabled = false
}
}
}
Instead of
test {
exclude '**/calltest/Summary.class'
}
try in Groovy
tasks.withType(Test) {
exclude '**/calltest/Summary.class'
}
or in Kotlin DSL (build.gradle.kts)
tasks.withType<Test> {
exclude("**/calltest/Summary.class")
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With