简体   繁体   中英

How to create separate Android build.gradle configs for Local tests vs Instrumented tests?

In my build.gradle file I'd like to specify "useJUnitPlatform()" only for my Local tests but not for my instrumented tests. I currently have the following declared in my app build.gradle:

testOptions {
    unitTests.all {
        useJUnitPlatform()
    }
    unitTests {
        includeAndroidResources = true
    }
}

The problem is that "unitTests.all" will apply the 'useJUnitPlatform' setting to all unit tests, not just my Local tests. Is there any syntax to restrict that setting to my Local tests only?

never mind. I found another solution. I left the testOptions args as they are but added this dependency: testImplementation "org.junit.vintage:junit-vintage-engine:5.8.2"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM