googlesamples/android-custom-lint-rules

Lint detector tests are not executed when using jUnit5

giangpham96 opened this issue · 1 comments

I have the same set up as android-studio-4 project, the only difference is I'm using jUnit5 for the detector tests. However, the tests are not executed when I run ./gradlew lint:test (They are executed if I use UI from Android Studio, not sure why). Here is my build.gradle (:lint):

import com.wolt.android.gradle.Dependencies

apply plugin: 'java-library'
apply plugin: 'kotlin'
apply plugin: 'com.android.lint'

lintOptions {
    htmlReport true
    htmlOutput file("lint-report.html")
    textReport true
    absolutePaths false
    ignoreTestSources true
}

dependencies {
    compileOnly Dependencies.Packages.kotlinStdLib
    compileOnly Dependencies.Packages.lintApi
    compileOnly Dependencies.Packages.lintChecks

    testImplementation Dependencies.TestPackages.junit5Api
    testImplementation Dependencies.TestPackages.lintTest
    testImplementation Dependencies.TestPackages.testUtils
    testRuntimeOnly Dependencies.TestPackages.junit5Engine
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

test {
    useJUnitPlatform()
    testLogging {
        events "passed", "skipped", "failed"
    }
}

nvm, I import the wrong Test annotation