Skip to content

Commit

Permalink
Migrate tests to Robolectric (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
DSteve595 authored Jun 24, 2019
1 parent 2a92684 commit e492c87
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 11 deletions.
7 changes: 0 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,3 @@ language: android
before_install:
- mkdir "$ANDROID_HOME/licenses" || true
- echo -e "\nd56f5187479451eabf01fb78af6dfcb131a6481e\n24333f8a63b6825ea9c5514f83c2829b004d1fee" > "$ANDROID_HOME/licenses/android-sdk-license"
before_script:
- sdkmanager "system-images;android-21;default;armeabi-v7a"
- sdkmanager "emulator"
- echo no | avdmanager create avd -f -n fastscroller_test_emulator -k "system-images;android-21;default;armeabi-v7a"
- $ANDROID_HOME/emulator/emulator -avd fastscroller_test_emulator -no-audio -no-window &
- android-wait-for-emulator
- adb shell input keyevent 82 &
10 changes: 6 additions & 4 deletions indicator-fast-scroll/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

testOptions.unitTests.includeAndroidResources = true

// TODO replace with https://issuetracker.google.com/issues/72050365 once released.
libraryVariants.all {
it.generateBuildConfig.enabled = false
Expand All @@ -30,8 +32,8 @@ dependencies {

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

testImplementation 'junit:junit:4.12'
androidTestImplementation "androidx.test.ext:junit:1.0.0"
androidTestImplementation 'androidx.test:rules:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
testImplementation "androidx.test.ext:junit:1.1.1"
testImplementation 'androidx.test:rules:1.2.0'
testImplementation 'androidx.test.espresso:espresso-core:3.2.0'
testImplementation 'org.robolectric:robolectric:4.3'
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ import org.junit.Assert.assertEquals
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.annotation.Config
import org.robolectric.annotation.LooperMode

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

Expand Down

0 comments on commit e492c87

Please sign in to comment.