I have one library(A) as a submodule in my android application.
android-app
|---app
| |
| |--main
| |--test
|
|--library(A)
|
|--main
|--test
When I try to run gradlew test
, it is executing libarary(A)
's test cases along with my app test cases.
How I can exclude my library project test cases from gradle execution.
buildTypes {
debug {
//disable crashlytics build id every time for development
ext.alwaysUpdateBuildId = false
// Run code coverage reports by default on debug builds.
testCoverageEnabled = true
}
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
//publishNonDefault true
productFlavors {
beta {
//applicationIdSuffix ".beta"
versionNameSuffix "-beta"
dimension "green"
}
production {
applicationId "com.example"
dimension "green"
}
}
Let's assume that you have build type(debug & release) and flavours(beta & production).
./gradlew testProductionReleaseUnitTest --tests "com.example.*"
OR
./gradlew test+{build_type}+{build_flavor}+UnitTest --tests "com.example.*"
This will only execute Production flavour Release build config unit test cases only in the com.example
package directory.
Using the above Gradle script you can avoid running test cases in your library projects.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments