Skip to content

Commit e492c87

Browse files
authored
Migrate tests to Robolectric (#13)
1 parent 2a92684 commit e492c87

9 files changed

Lines changed: 10 additions & 11 deletions

File tree

.travis.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,3 @@ language: android
22
before_install:
33
- mkdir "$ANDROID_HOME/licenses" || true
44
- echo -e "\nd56f5187479451eabf01fb78af6dfcb131a6481e\n24333f8a63b6825ea9c5514f83c2829b004d1fee" > "$ANDROID_HOME/licenses/android-sdk-license"
5-
before_script:
6-
- sdkmanager "system-images;android-21;default;armeabi-v7a"
7-
- sdkmanager "emulator"
8-
- echo no | avdmanager create avd -f -n fastscroller_test_emulator -k "system-images;android-21;default;armeabi-v7a"
9-
- $ANDROID_HOME/emulator/emulator -avd fastscroller_test_emulator -no-audio -no-window &
10-
- android-wait-for-emulator
11-
- adb shell input keyevent 82 &

indicator-fast-scroll/build.gradle

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ android {
1414
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1515
}
1616

17+
testOptions.unitTests.includeAndroidResources = true
18+
1719
// TODO replace with https://issuetracker.google.com/issues/72050365 once released.
1820
libraryVariants.all {
1921
it.generateBuildConfig.enabled = false
@@ -30,8 +32,8 @@ dependencies {
3032

3133
implementation 'androidx.core:core-ktx:1.0.1'
3234

33-
testImplementation 'junit:junit:4.12'
34-
androidTestImplementation "androidx.test.ext:junit:1.0.0"
35-
androidTestImplementation 'androidx.test:rules:1.1.0'
36-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
35+
testImplementation "androidx.test.ext:junit:1.1.1"
36+
testImplementation 'androidx.test:rules:1.2.0'
37+
testImplementation 'androidx.test.espresso:espresso-core:3.2.0'
38+
testImplementation 'org.robolectric:robolectric:4.3'
3739
}

indicator-fast-scroll/src/androidTest/AndroidManifest.xml renamed to indicator-fast-scroll/src/test/AndroidManifest.xml

File renamed without changes.

indicator-fast-scroll/src/androidTest/java/com/reddit/indicatorfastscroll/TestActivity.kt renamed to indicator-fast-scroll/src/test/java/com/reddit/indicatorfastscroll/TestActivity.kt

File renamed without changes.

indicator-fast-scroll/src/androidTest/java/com/reddit/indicatorfastscroll/TestItemIndicatorsBuilder.kt renamed to indicator-fast-scroll/src/test/java/com/reddit/indicatorfastscroll/TestItemIndicatorsBuilder.kt

File renamed without changes.

indicator-fast-scroll/src/androidTest/java/com/reddit/indicatorfastscroll/Tests.kt renamed to indicator-fast-scroll/src/test/java/com/reddit/indicatorfastscroll/Tests.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@ import org.junit.Assert.assertEquals
1313
import org.junit.Rule
1414
import org.junit.Test
1515
import org.junit.runner.RunWith
16+
import org.robolectric.annotation.Config
17+
import org.robolectric.annotation.LooperMode
1618

1719
@RunWith(AndroidJUnit4::class)
20+
@Config(sdk = [21], qualifiers = "xhdpi")
21+
@LooperMode(LooperMode.Mode.PAUSED)
1822
@LargeTest
1923
class Tests {
2024

indicator-fast-scroll/src/androidTest/res/layout/test.xml renamed to indicator-fast-scroll/src/test/res/layout/test.xml

File renamed without changes.

indicator-fast-scroll/src/androidTest/res/values/dimens.xml renamed to indicator-fast-scroll/src/test/res/values/dimens.xml

File renamed without changes.

indicator-fast-scroll/src/androidTest/res/values/styles.xml renamed to indicator-fast-scroll/src/test/res/values/styles.xml

File renamed without changes.

0 commit comments

Comments
 (0)