mirror of
https://github.com/nextcloud/android.git
synced 2024-11-24 06:05:42 +03:00
Run sample instrumented unit test in Travis
This commit is contained in:
parent
b826c80cb8
commit
2cfcb2318c
3 changed files with 40 additions and 10 deletions
25
.travis.yml
25
.travis.yml
|
@ -2,17 +2,32 @@ sudo: false
|
|||
language: android
|
||||
android:
|
||||
components:
|
||||
- platform-tools
|
||||
- tools
|
||||
- build-tools-23.0.3
|
||||
- android-23
|
||||
- android-22
|
||||
- android-19
|
||||
- extra-android-m2repository
|
||||
- sys-img-armeabi-v7a-android-23
|
||||
before_install:
|
||||
- echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI -c 20M
|
||||
- emulator -avd test -no-skin -no-audio -no-window &
|
||||
- chmod +x ./wait_for_emulator.sh
|
||||
- ./wait_for_emulator.sh
|
||||
script:
|
||||
- ./setup_env.sh ant
|
||||
- ant clean
|
||||
- ant debug
|
||||
# build app and assemble APK, in debug mode
|
||||
- ./gradlew assembleDebug
|
||||
# run all the local unit tests
|
||||
- ./gradlew testDebug
|
||||
# - ./gradlew connectedAndroidTest
|
||||
# install app, then assemble and install instrumented tests
|
||||
- ./gradlew installDebug
|
||||
- ./gradlew installDebugAndroidTest
|
||||
# run sample instrumented unit test
|
||||
- adb shell am instrument -w -e debug false -e class com.owncloud.android.datamodel.OCFileUnitTest com.owncloud.android.test/android.support.test.runner.AndroidJUnitRunner
|
||||
env:
|
||||
global:
|
||||
- secure: bm8mkBKaujxI/C7Kp2NjwDl0vsfWd3qDGZ+7WiLPGTbXnwJf8urxFQLrMkhqIR4wZs2M1LSW+P9SfD2FwL5Y0GDo29IeYLqhW5LIT8tGCZevBUfMDqd4w+eFHY73FXEAwLWVavfKmeuyisK/JNwGr75penOuQkZXTow6wgNLBjs=
|
||||
- secure: EqLPMLaAcr+6NKeXWJdaUiNfMHJ+zdocKw7SyWsezKMMfsY6hME22m8TNHJZpt0nPCDoX7iPjJoh8svOe2RZo6UZG2q4hjcLxBu29b7QvJeChq7oJvjXPVNRUg2P2zJ2OUBbnyOhpw3cZruIncSr+QasSD8FGI7j3kw3t/86YE0=
|
||||
- secure: pfNH4RVBy0vRPKRY3z4EQD9SRPyCuqYISQ+87cOlfpVbYHOc7xspaQSg7L9sB/sBMumOuMgGSLD6RincRrSy6nHhd70Vm4ccJxJYOynqDxC3EXNihDesw9Q+MJh1mr7WpTP21sXpP4+HkLQV0U+bKl3xcnGgeR4FU3BWYigNMkA=
|
||||
matrix:
|
||||
- ANDROID_TARGET=android-23 ANDROID_ABI=armeabi-v7a
|
||||
|
|
|
@ -66,10 +66,6 @@ android {
|
|||
defaultConfig {
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
|
||||
buildConfigField "String", "TEST_USER", "${TEST_USER}"
|
||||
buildConfigField "String", "TEST_PASSWORD", "${TEST_PASSWORD}"
|
||||
buildConfigField "String", "TEST_SERVER_URL", "${TEST_SERVER_URL}"
|
||||
|
||||
testInstrumentationRunnerArguments TEST_USER: "${TEST_USER}"
|
||||
testInstrumentationRunnerArguments TEST_PASSWORD: "${TEST_PASSWORD}"
|
||||
testInstrumentationRunnerArguments TEST_SERVER_URL: "${TEST_SERVER_URL}"
|
||||
|
|
19
wait_for_emulator.sh
Normal file
19
wait_for_emulator.sh
Normal file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
bootanim=""
|
||||
failcounter=0
|
||||
checkcounter=0
|
||||
until [[ "$bootanim" =~ "stopped" ]]; do
|
||||
bootanim=`adb -e shell getprop init.svc.bootanim 2>&1`
|
||||
echo "($checkcounter) $bootanim"
|
||||
if [[ "$bootanim" =~ "not found" ]]; then
|
||||
let "failcounter += 1"
|
||||
if [[ $failcounter -gt 30 ]]; then
|
||||
echo "Failed to start emulator"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
let "checkcounter += 1"
|
||||
sleep 10
|
||||
done
|
||||
echo "Done"
|
Loading…
Reference in a new issue