Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

connectedAndroidTest and release build type

I'm using gradle:1.2.3

I would like to run my androidConntectTests (instrumentation tests) on release (signed, minified) configuration, but I cannot.

My build types:

buildTypes {
    debug {         
        minifyEnabled false
        debuggable true
    }

    robotium {
        debuggable true
        minifyEnabled true
        signingConfig signingConfigs.release
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }

    release {
        minifyEnabled true
        debuggable false
        signingConfig signingConfigs.release
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

I have read, that those tests can only be run on debbugable configurations, so I made "robotium" build type (see above), but it still does not work.

When I try calling "gradle tasks" it shows only connectedAndroidTest-Flavour-Debug, and calling "connectedAndroidTest-Flavour-Release/Robobium" simply fails with "task XXX not found in root project".

Is there any way to make instrumentation tests run on diffrent build type?

like image 389
Max Avatar asked Dec 07 '15 13:12

Max


1 Answers

The android gradle plugin will create test variants for all your flavors. To switch the build type used you can do this, as stated in the documentation

Currently only one Build Type is tested. By default it is the debug Build Type, but this can be reconfigured with:

android {
    ...
    testBuildType "staging"
}
like image 115
David Medenjak Avatar answered Nov 18 '22 10:11

David Medenjak