How I do Exclude Android Project Submodule's test from Gradle test

Ilanthirayan Paramanathan

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.

Ilanthirayan Paramanathan
    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.

edited at
0

Comments

0 comments
Login to comment

Related

How Do I Pull Maven Test Jars Using Gradle?

How do I include a dependency's test jar into a Maven project's deployment?

How do I create an Android Test Module in IntelliJ 13 for a Gradle Android project?

How can I run a single instrumentation test with Gradle Android

How do I add a dependency to the android gradle task 'test'?

How do I exclude test functions from code coverage when using kcov?

Gradle android, how to exclude a single unit test

Exclude files from test

How do I exclude all subdirectories from Gradle zip task using Ant include/exclude pattern?

How can I exclude files in Gradle's jar.from?

How can I exclude a particular file from test coverage analysis?

How Do I Stop Gradle Instrumented Test Runs From Uninstalling the App?

How do I configure a dependency in a gradle project such that it also works as a submodule?

How do I make IDEA/Android Studio recognize my unit test folder when using Gradle?

How do I exclude a package from an imported JAR for a project in Eclipse?

How do you include the JMonkey test data jar on a Gradle project?

How to include a dependency to parent test classes for a submodule in a Gradle multiple project build?

How do I "export" things from a submodule?

How do I load module from the project in a test script?

Android: how do I exclude a CardView's checkbox from a LongClick method?

How do I test apps on emulators in Visual Studio without including the app's project in the solution?

Android Unit Testing : How do I test this?

How do I exclude a git submodule from update using python?

How do I exclude a test in an Abstract Test (parent test class) in some children in JUnit?

Spring boot, exclude dependencies from test in Gradle 5

How do I access playwright test runner project info in a test?

How do I exclude specific time periods from availability test?

Exclude Test folder and Resources from Gradle Jar build

How do I get a Gradle property in a Scala test?