• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Gradle testOptions not working

mcpixel

Newbie
My build.grandle:
Code:
apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.1"
    defaultConfig {
        applicationId "com.example.app5"
        testApplicationId "com.example.app5.test"
        minSdkVersion 16
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.test.InstrumentationTestRunner"
        testHandleProfiling true
        testFunctionalTest true
    }
    testBuildType "debug"
    testOptions {
        reportDir "$rootDir/test-reports"
        resultsDir "$rootDir/test-results"
        unitTests {
            returnDefaultValues true
            all {
                jvmArgs '-XX:MaxPermSize=256m'
                if(it.name == 'testDebugUnitTest')
                    systemProperty 'debug', 'true'
            }
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
I specified reportDir. but when I run the unit test, I don’t see anything in the project folder in the test-results folder, that is, this option does not work, it seems to have to save the results to that folder automatically, and it seems the whole testOptions block does not work. What could be the problem ?
 
Back
Top Bottom