diff --git a/AndroidTestingBlueprint-kotlinApp/app/build.gradle b/AndroidTestingBlueprint-kotlinApp/app/build.gradle index 33864b9..c2751cf 100644 --- a/AndroidTestingBlueprint-kotlinApp/app/build.gradle +++ b/AndroidTestingBlueprint-kotlinApp/app/build.gradle @@ -15,7 +15,7 @@ android { versionCode 1 versionName '1.0' - testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner' + testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' /* The Android Testing Support Library collects analytics to continuously improve the testing experience. More specifically, it uploads a hash of the package name of the application @@ -72,8 +72,8 @@ android { dependencies { // App's dependencies, including test - implementation "com.android.support:appcompat-v7:$rootProject.ext.supportLibVersion" - implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlinVersion" + implementation "androidx.appcompat:appcompat:$appcompatVersion" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" implementation project(':module-plain-kotlin') // Optional module for non-Android code implementation project(':module-android-library') // Optional module for additional Android code @@ -84,11 +84,11 @@ dependencies { testImplementation "org.hamcrest:hamcrest-all:$rootProject.ext.hamcrestVersion" // Android Testing Support Library's runner and rules - androidTestImplementation "com.android.support.test:runner:$rootProject.ext.runnerVersion" - androidTestImplementation "com.android.support.test:rules:$rootProject.ext.rulesVersion" + androidTestImplementation "androidx.test.ext:junit:1.1.1" + androidTestImplementation "androidx.test:rules:$rulesVersion" // Espresso UI Testing - androidTestImplementation "com.android.support.test.espresso:espresso-core:$rootProject.ext.espressoVersion" + androidTestImplementation "androidx.test.espresso:espresso-core:$espressoVersion" // Espresso-Contrib, Intents and Web dependencies are not used in this project. /* @@ -98,9 +98,9 @@ dependencies { */ // UIAutomator Testing. Learn about this dependency in this projects README file. - androidTestImplementation "com.android.support.test.uiautomator:uiautomator-v18:$rootProject.ext.uiautomatorVersion" + androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0' // Resolve conflicts between main and test APK: - androidTestImplementation "com.android.support:support-annotations:$rootProject.supportLibVersion" + androidTestImplementation 'androidx.annotation:annotation:1.1.0' } diff --git a/AndroidTestingBlueprint-kotlinApp/app/src/androidTest/java/com/example/android/testing/blueprint/integration/AndroidLibraryModuleIntegrationTest.kt b/AndroidTestingBlueprint-kotlinApp/app/src/androidTest/java/com/example/android/testing/blueprint/integration/AndroidLibraryModuleIntegrationTest.kt index 8779149..18ada08 100644 --- a/AndroidTestingBlueprint-kotlinApp/app/src/androidTest/java/com/example/android/testing/blueprint/integration/AndroidLibraryModuleIntegrationTest.kt +++ b/AndroidTestingBlueprint-kotlinApp/app/src/androidTest/java/com/example/android/testing/blueprint/integration/AndroidLibraryModuleIntegrationTest.kt @@ -17,9 +17,9 @@ package com.example.android.testing.blueprint.integration import android.content.Context -import android.support.test.InstrumentationRegistry -import android.support.test.InstrumentationRegistry.getTargetContext -import android.support.test.runner.AndroidJUnit4 +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.platform.app.InstrumentationRegistry.getTargetContext +import androidx.test.ext.junit.runners.AndroidJUnit4 import com.example.android.testing.blueprint.R import com.example.android.testing.blueprint.androidlibrarymodule.AndroidLibraryModuleClass import org.hamcrest.CoreMatchers.equalTo diff --git a/AndroidTestingBlueprint-kotlinApp/app/src/androidTest/java/com/example/android/testing/blueprint/ui/espresso/EspressoTest.kt b/AndroidTestingBlueprint-kotlinApp/app/src/androidTest/java/com/example/android/testing/blueprint/ui/espresso/EspressoTest.kt index 2cb1ad6..001a908 100644 --- a/AndroidTestingBlueprint-kotlinApp/app/src/androidTest/java/com/example/android/testing/blueprint/ui/espresso/EspressoTest.kt +++ b/AndroidTestingBlueprint-kotlinApp/app/src/androidTest/java/com/example/android/testing/blueprint/ui/espresso/EspressoTest.kt @@ -16,13 +16,13 @@ package com.example.android.testing.blueprint.ui.espresso -import android.support.test.espresso.Espresso.onView -import android.support.test.espresso.action.ViewActions.click -import android.support.test.espresso.assertion.ViewAssertions.matches -import android.support.test.espresso.matcher.ViewMatchers.withId -import android.support.test.espresso.matcher.ViewMatchers.withText -import android.support.test.rule.ActivityTestRule -import android.support.test.runner.AndroidJUnit4 +import androidx.test.espresso.Espresso.onView +import androidx.test.espresso.action.ViewActions.click +import androidx.test.espresso.assertion.ViewAssertions.matches +import androidx.test.espresso.matcher.ViewMatchers.withId +import androidx.test.espresso.matcher.ViewMatchers.withText +import androidx.test.rule.ActivityTestRule +import androidx.test.ext.junit.runners.AndroidJUnit4 import com.example.android.testing.blueprint.HelloTestingBlueprintActivity import com.example.android.testing.blueprint.R import org.junit.Rule diff --git a/AndroidTestingBlueprint-kotlinApp/app/src/androidTest/java/com/example/android/testing/blueprint/ui/uiautomator/UiAutomatorTest.kt b/AndroidTestingBlueprint-kotlinApp/app/src/androidTest/java/com/example/android/testing/blueprint/ui/uiautomator/UiAutomatorTest.kt index dc4f764..a7f6f0f 100644 --- a/AndroidTestingBlueprint-kotlinApp/app/src/androidTest/java/com/example/android/testing/blueprint/ui/uiautomator/UiAutomatorTest.kt +++ b/AndroidTestingBlueprint-kotlinApp/app/src/androidTest/java/com/example/android/testing/blueprint/ui/uiautomator/UiAutomatorTest.kt @@ -19,12 +19,12 @@ package com.example.android.testing.blueprint.ui.uiautomator import android.app.Activity import android.content.Intent import android.content.pm.PackageManager -import android.support.test.InstrumentationRegistry -import android.support.test.filters.SdkSuppress -import android.support.test.runner.AndroidJUnit4 -import android.support.test.uiautomator.By -import android.support.test.uiautomator.UiDevice -import android.support.test.uiautomator.Until +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.filters.SdkSuppress +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.uiautomator.By +import androidx.test.uiautomator.UiDevice +import androidx.test.uiautomator.Until import com.example.android.testing.blueprint.R import org.hamcrest.Matchers.notNullValue import org.junit.Assert.assertEquals diff --git a/AndroidTestingBlueprint-kotlinApp/app/src/main/java/com/example/android/testing/blueprint/HelloTestingBlueprintActivity.kt b/AndroidTestingBlueprint-kotlinApp/app/src/main/java/com/example/android/testing/blueprint/HelloTestingBlueprintActivity.kt index 09d9a6f..3a34bd6 100644 --- a/AndroidTestingBlueprint-kotlinApp/app/src/main/java/com/example/android/testing/blueprint/HelloTestingBlueprintActivity.kt +++ b/AndroidTestingBlueprint-kotlinApp/app/src/main/java/com/example/android/testing/blueprint/HelloTestingBlueprintActivity.kt @@ -17,7 +17,7 @@ package com.example.android.testing.blueprint import android.os.Bundle -import android.support.v7.app.AppCompatActivity +import androidx.appcompat.app.AppCompatActivity import android.view.View import android.widget.TextView diff --git a/AndroidTestingBlueprint-kotlinApp/build.gradle b/AndroidTestingBlueprint-kotlinApp/build.gradle index 0a5282f..56fe265 100644 --- a/AndroidTestingBlueprint-kotlinApp/build.gradle +++ b/AndroidTestingBlueprint-kotlinApp/build.gradle @@ -3,17 +3,17 @@ buildscript { ext { minSdkVersion = 14 - targetSdkVersion = 27 - compileSdkVersion = 27 + targetSdkVersion = 29 + compileSdkVersion = 29 - kotlinVersion = "1.2.0" - supportLibVersion = "27.0.2" + kotlinVersion = "1.3.50" + appcompatVersion = "1.1.0" junitVersion = "4.12" mockitoVersion = "1.10.19" hamcrestVersion = "1.3" runnerVersion = "0.5" - rulesVersion = "0.5" - espressoVersion = "2.2.2" + rulesVersion = "1.2.0" + espressoVersion = "3.2.0" uiautomatorVersion = "2.1.2" } @@ -23,7 +23,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.0.1' + classpath 'com.android.tools.build:gradle:3.5.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" // NOTE: Do not place your application dependencies here; they belong diff --git a/AndroidTestingBlueprint-kotlinApp/gradle.properties b/AndroidTestingBlueprint-kotlinApp/gradle.properties index 1d3591c..915f0e6 100644 --- a/AndroidTestingBlueprint-kotlinApp/gradle.properties +++ b/AndroidTestingBlueprint-kotlinApp/gradle.properties @@ -15,4 +15,6 @@ # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true \ No newline at end of file +# org.gradle.parallel=true +android.enableJetifier=true +android.useAndroidX=true \ No newline at end of file diff --git a/AndroidTestingBlueprint-kotlinApp/gradle/wrapper/gradle-wrapper.properties b/AndroidTestingBlueprint-kotlinApp/gradle/wrapper/gradle-wrapper.properties index abd2403..e5a6e1a 100644 --- a/AndroidTestingBlueprint-kotlinApp/gradle/wrapper/gradle-wrapper.properties +++ b/AndroidTestingBlueprint-kotlinApp/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Tue Dec 06 13:05:10 GMT 2016 +#Thu Nov 14 21:02:05 IST 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.3.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip diff --git a/AndroidTestingBlueprint-kotlinApp/module-android-library/build.gradle b/AndroidTestingBlueprint-kotlinApp/module-android-library/build.gradle index 40e21fe..3ba6248 100644 --- a/AndroidTestingBlueprint-kotlinApp/module-android-library/build.gradle +++ b/AndroidTestingBlueprint-kotlinApp/module-android-library/build.gradle @@ -11,7 +11,7 @@ android { versionCode 1 versionName "1.0" - testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner' + testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' // Define ProGuard rules for this android library project. These rules will be applied when // a consumer of this library sets 'minifyEnabled true'. @@ -20,9 +20,9 @@ android { } dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlinVersion" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" // Android Testing Support Library's runner and rules - androidTestImplementation "com.android.support.test:runner:$rootProject.ext.runnerVersion" - androidTestImplementation "com.android.support.test:rules:$rootProject.ext.rulesVersion" + androidTestImplementation "androidx.test.ext:junit:1.1.1" + androidTestImplementation "androidx.test:rules:$rulesVersion" } diff --git a/AndroidTestingBlueprint-kotlinApp/module-android-library/src/androidTest/java/com/example/android/testing/blueprint/androidlibrarymodule/AndroidLibraryModuleTest.kt b/AndroidTestingBlueprint-kotlinApp/module-android-library/src/androidTest/java/com/example/android/testing/blueprint/androidlibrarymodule/AndroidLibraryModuleTest.kt index aaed753..1033d80 100644 --- a/AndroidTestingBlueprint-kotlinApp/module-android-library/src/androidTest/java/com/example/android/testing/blueprint/androidlibrarymodule/AndroidLibraryModuleTest.kt +++ b/AndroidTestingBlueprint-kotlinApp/module-android-library/src/androidTest/java/com/example/android/testing/blueprint/androidlibrarymodule/AndroidLibraryModuleTest.kt @@ -17,8 +17,8 @@ package com.example.android.testing.blueprint.androidlibrarymodule import android.content.Context -import android.support.test.InstrumentationRegistry -import android.support.test.runner.AndroidJUnit4 +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 import org.junit.Assert.assertEquals import org.junit.Assert.assertTrue import org.junit.Before diff --git a/AndroidTestingBlueprint-kotlinApp/module-flavor1-androidTest-only/build.gradle b/AndroidTestingBlueprint-kotlinApp/module-flavor1-androidTest-only/build.gradle index 9d55b22..484cc5a 100644 --- a/AndroidTestingBlueprint-kotlinApp/module-flavor1-androidTest-only/build.gradle +++ b/AndroidTestingBlueprint-kotlinApp/module-flavor1-androidTest-only/build.gradle @@ -14,7 +14,7 @@ android { // The package name of the test app testApplicationId 'com.example.android.testing.blueprint.test' // The Instrumentation test runner used to run tests. - testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner' + testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' } // Set the target app project. The module specified here should contain the production code @@ -24,8 +24,8 @@ android { dependencies { // Android Testing Support Library's runner and rules and hamcrest matchers - implementation "com.android.support.test:runner:$rootProject.ext.runnerVersion" - implementation "com.android.support.test:rules:$rootProject.ext.rulesVersion" + implementation "androidx.test.ext:junit:1.1.1" + implementation "androidx.test:rules:$rulesVersion" implementation "org.hamcrest:hamcrest-core:$rootProject.ext.hamcrestVersion" - implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlinVersion" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" } diff --git a/AndroidTestingBlueprint-kotlinApp/module-flavor1-androidTest-only/src/main/AndroidManifest.xml b/AndroidTestingBlueprint-kotlinApp/module-flavor1-androidTest-only/src/main/AndroidManifest.xml index c894d5e..01c2218 100644 --- a/AndroidTestingBlueprint-kotlinApp/module-flavor1-androidTest-only/src/main/AndroidManifest.xml +++ b/AndroidTestingBlueprint-kotlinApp/module-flavor1-androidTest-only/src/main/AndroidManifest.xml @@ -15,6 +15,6 @@ package="com.example.android.testing.blueprint.test"> - diff --git a/AndroidTestingBlueprint-kotlinApp/module-flavor1-androidTest-only/src/main/java/com/example/android/testing/blueprint/test/AndroidTestOnlyModuleTest.kt b/AndroidTestingBlueprint-kotlinApp/module-flavor1-androidTest-only/src/main/java/com/example/android/testing/blueprint/test/AndroidTestOnlyModuleTest.kt index 229ceef..4e6d31f 100644 --- a/AndroidTestingBlueprint-kotlinApp/module-flavor1-androidTest-only/src/main/java/com/example/android/testing/blueprint/test/AndroidTestOnlyModuleTest.kt +++ b/AndroidTestingBlueprint-kotlinApp/module-flavor1-androidTest-only/src/main/java/com/example/android/testing/blueprint/test/AndroidTestOnlyModuleTest.kt @@ -17,8 +17,8 @@ package com.example.android.testing.blueprint.test import android.content.Context -import android.support.test.InstrumentationRegistry.getTargetContext -import android.support.test.runner.AndroidJUnit4 +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.platform.app.InstrumentationRegistry import com.example.android.testing.blueprint.R import junit.framework.Assert.assertEquals import org.junit.Before @@ -35,7 +35,7 @@ class AndroidTestOnlyModuleTest { @Before fun initTargetContext() { // Obtain the target context from InstrumentationRegistry - context = getTargetContext() + context = InstrumentationRegistry.getInstrumentation().targetContext } @Test fun verifyResourceString() { diff --git a/AndroidTestingBlueprint-kotlinApp/module-plain-kotlin/build.gradle b/AndroidTestingBlueprint-kotlinApp/module-plain-kotlin/build.gradle index 322ee79..b18bcf9 100644 --- a/AndroidTestingBlueprint-kotlinApp/module-plain-kotlin/build.gradle +++ b/AndroidTestingBlueprint-kotlinApp/module-plain-kotlin/build.gradle @@ -1,9 +1,10 @@ apply plugin: 'kotlin' dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlinVersion" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" // Dependencies for local unit tests - testCompile 'junit:junit:' + rootProject.ext.junitVersion - testCompile 'org.hamcrest:hamcrest-core:' + rootProject.ext.hamcrestVersion + + testImplementation 'junit:junit:' + rootProject.ext.junitVersion + testImplementation 'org.hamcrest:hamcrest-core:' + rootProject.ext.hamcrestVersion }