Added instrumentation testing dependencies

This commit is contained in:
Arty Bishop committed 2022-02-19 12:07:39 +00:00
1 parent 7eb25e45b3
commit 28a6fecab3
3 files changed
+47 -1

No files matched your search

+9 -1
View File
@@ -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"
}
@@ -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)
}
}
@@ -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)
}
}