diff --git a/matrix-sdk-android/build.gradle b/matrix-sdk-android/build.gradle index ca92df08c5..422a5dac1d 100644 --- a/matrix-sdk-android/build.gradle +++ b/matrix-sdk-android/build.gradle @@ -31,6 +31,11 @@ android { multiDexEnabled true testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + // The following argument makes the Android Test Orchestrator run its + // "pm clear" command after each test invocation. This command ensures + // that the app's state is completely cleared between tests. + testInstrumentationRunnerArguments clearPackageData: 'true' + buildConfigField "String", "GIT_SDK_REVISION", "\"${gitRevision()}\"" resValue "string", "git_sdk_revision", "\"${gitRevision()}\"" resValue "string", "git_sdk_revision_unix_date", "\"${gitRevisionUnixDate()}\"" @@ -41,6 +46,10 @@ android { } } + testOptions { + execution 'ANDROIDX_TEST_ORCHESTRATOR' + } + buildTypes { debug { @@ -194,4 +203,7 @@ dependencies { androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version" // Plant Timber tree for test androidTestImplementation 'net.lachlanmckee:timber-junit-rule:1.0.1' + + androidTestUtil 'androidx.test:orchestrator:1.2.0' + }