Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixed Robolectric test app * Fixed Robolectric test
- Loading branch information
1 parent
154104d
commit 9075923
Showing
16 changed files
with
214 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
@file:Suppress("SpellCheckingInspection") | ||
|
||
object AndroidLibs { | ||
const val robolectric = "org.robolectric:robolectric:4.4" | ||
|
||
object KotlinX { | ||
const val coroutinesAndroid = "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9" | ||
} | ||
|
||
object AndroidX { | ||
const val coreKtx = "androidx.core:core-ktx:1.3.1" | ||
const val appCompat = "androidx.appcompat:appcompat:1.2.0" | ||
const val constraintLayout = "androidx.constraintlayout:constraintlayout:2.0.1" | ||
|
||
object ArchCore { | ||
private const val version = "2.1.0" | ||
|
||
const val common = "androidx.arch.core:core-common:$version" | ||
const val runtime = "androidx.arch.core:core-runtime:$version" | ||
const val testing = "androidx.arch.core:core-testing:$version" | ||
} | ||
|
||
object Fragment { | ||
private const val version = "1.2.5" | ||
|
||
const val fragmentKtx = "androidx.fragment:fragment-ktx:$version" | ||
const val testing = "androidx.fragment:fragment-testing:$version" | ||
} | ||
|
||
object Navigation { | ||
private const val version = "2.3.0" | ||
|
||
const val runtimeKtx = "androidx.navigation:navigation-runtime-ktx:$version" | ||
const val fragmentKtx = "androidx.navigation:navigation-fragment-ktx:$version" | ||
const val uiKtx = "androidx.navigation:navigation-ui-ktx:$version" | ||
} | ||
|
||
object Lifecycle { | ||
private const val version = "2.2.0" | ||
|
||
const val runtimeKtx = "androidx.lifecycle:lifecycle-runtime-ktx:$version" | ||
const val liveDataKtx = "androidx.lifecycle:lifecycle-livedata-ktx:$version" | ||
const val viewModelKtx = "androidx.lifecycle:lifecycle-viewmodel-ktx:$version" | ||
} | ||
|
||
object Espresso { | ||
const val core = "androidx.test.espresso:espresso-core:3.3.0" | ||
} | ||
|
||
object Testing { | ||
private const val version = "1.3.0" | ||
|
||
const val extJUnit = "androidx.test.ext:junit:1.1.2" | ||
const val runner = "androidx.test:runner:$version" | ||
const val rules = "androidx.test:rules:$version" | ||
const val monitor = "androidx.test:monitor:$version" | ||
} | ||
} | ||
|
||
object Google { | ||
const val materialComponents = "com.google.android.material:material:1.2.1" | ||
} | ||
|
||
const val desugarJdk = "com.android.tools:desugar_jdk_libs:1.0.10" | ||
const val liveDataTestingKtx = "com.jraska.livedata:testing-ktx:1.1.2" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Tue Oct 06 11:32:18 BST 2020 | ||
#Fri Oct 09 09:29:11 BST 2020 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...ava/io/kotest/androidtest/MainActivity.kt → .../com/sksamuel/robolectric/MainActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 18 additions & 12 deletions
30
kotest-tests/kotest-tests-robolectric/src/main/res/layout/activity_main.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,20 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context="io.kotest.androidtest.MainActivity"> | ||
|
||
<TextView | ||
android:id="@+id/textview" | ||
android:layout_height="wrap_content" | ||
android:layout_width="wrap_content" | ||
android:text="Kotest!"/> | ||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context="com.sksamuel.robolectric.MainActivity"> | ||
|
||
</LinearLayout> | ||
<TextView | ||
android:id="@+id/textview" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="Kotest!" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintLeft_toLeftOf="parent" | ||
app:layout_constraintRight_toRightOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" | ||
tools:ignore="HardcodedText" /> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
1 change: 0 additions & 1 deletion
1
kotest-tests/kotest-tests-robolectric/src/main/res/values/strings.xml
This file was deleted.
Oops, something went wrong.
17 changes: 17 additions & 0 deletions
17
...s/kotest-tests-robolectric/src/test/java/com/sksamuel/robolectric/DummyRobolectricTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.sksamuel.robolectric | ||
|
||
import androidx.test.core.app.ActivityScenario | ||
import androidx.test.espresso.Espresso.onView | ||
import androidx.test.espresso.assertion.ViewAssertions | ||
import androidx.test.espresso.matcher.ViewMatchers.withId | ||
import androidx.test.espresso.matcher.ViewMatchers.withText | ||
import io.kotest.core.spec.style.FunSpec | ||
import io.kotest.extensions.robolectric.RobolectricTest | ||
|
||
@RobolectricTest | ||
class DummyRobolectricTest : FunSpec({ | ||
test("Hello, Robo!") { | ||
ActivityScenario.launch(MainActivity::class.java) | ||
onView(withId(R.id.textview)).check(ViewAssertions.matches(withText("Kotest!"))) | ||
} | ||
}) |
6 changes: 3 additions & 3 deletions
6
...va/io/kotest/androidtest/ProjectConfig.kt → ...com/sksamuel/robolectric/ProjectConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
package io.kotest.androidtest | ||
package com.sksamuel.robolectric | ||
|
||
import io.kotest.core.config.AbstractProjectConfig | ||
import io.kotest.core.extensions.ConstructorExtension | ||
import io.kotest.core.extensions.Extension | ||
import io.kotest.extensions.robolectric.RobolectricExtension | ||
|
||
object ProjectConfig : AbstractProjectConfig() { | ||
override fun extensions() = listOf(RobolectricExtension() as ConstructorExtension) | ||
@Suppress("CAST_NEVER_SUCCEEDS") | ||
override fun extensions() = listOf(RobolectricExtension() as Extension) | ||
} |
Oops, something went wrong.