diff --git a/app/build.gradle b/app/build.gradle index 3feb86e6..c87b2597 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -42,6 +42,7 @@ android { } testOptions { animationsDisabled true + unitTests.includeAndroidResources = true } compileOptions { sourceCompatibility JavaVersion.VERSION_11 @@ -72,11 +73,18 @@ dependencies { implementation "org.osmdroid:osmdroid-android:6.1.11" + debugImplementation "androidx.fragment:fragment-testing:1.4.1" debugImplementation "com.squareup.leakcanary:leakcanary-android:2.8.1" testImplementation "junit:junit:4.13.2" testImplementation "org.mockito:mockito-core:4.3.1" + testImplementation "org.robolectric:robolectric:4.7.3" testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.0" + androidTestImplementation "androidx.test:core:1.4.0" + androidTestImplementation "androidx.test:runner:1.4.0" + androidTestImplementation "androidx.test:rules:1.4.0" androidTestImplementation "androidx.test.ext:junit:1.1.3" - androidTestImplementation "org.mockito:mockito-android:4.3.1" + androidTestImplementation "androidx.test.ext:truth:1.4.0" androidTestImplementation "androidx.test.espresso:espresso-core:3.4.0" + androidTestImplementation "org.mockito:mockito-android:4.3.1" + androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.0" } \ No newline at end of file diff --git a/app/src/androidTest/java/com/rtbishop/look4sat/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/rtbishop/look4sat/ExampleInstrumentedTest.kt new file mode 100644 index 00000000..6445987e --- /dev/null +++ b/app/src/androidTest/java/com/rtbishop/look4sat/ExampleInstrumentedTest.kt @@ -0,0 +1,22 @@ +package com.rtbishop.bbctestapp + +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.platform.app.InstrumentationRegistry +import org.junit.Assert.assertEquals +import org.junit.Test +import org.junit.runner.RunWith + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.rtbishop.bbctestapp", appContext.packageName) + } +} \ No newline at end of file diff --git a/app/src/test/java/com/rtbishop/look4sat/ExampleUnitTest.kt b/app/src/test/java/com/rtbishop/look4sat/ExampleUnitTest.kt new file mode 100644 index 00000000..7dfb5e32 --- /dev/null +++ b/app/src/test/java/com/rtbishop/look4sat/ExampleUnitTest.kt @@ -0,0 +1,16 @@ +package com.rtbishop.bbctestapp + +import org.junit.Assert.assertEquals +import org.junit.Test + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +} \ No newline at end of file