Skip to content

Commit b7d1c4c

Browse files
using script to run Tests, to test the project locally as well as on travis-ci
1 parent b6ddbb9 commit b7d1c4c

File tree

4 files changed

+34
-14
lines changed

4 files changed

+34
-14
lines changed

.travis.yml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,4 @@ android:
1414
- sys-img-armeabi-v7a-android-16
1515

1616
script:
17-
- echo no | android create avd -c 50M --force -n testx86 -t android-16 --abi x86
18-
- emulator -avd testx86 -no-skin -no-audio -no-window &
19-
- EMULATOR_PID=$!
20-
- android-wait-for-emulator
21-
- adb shell input keyevent 82 &
22-
- ./gradlew --info build connectedAndroidTest
23-
- kill -9 $EMULATOR_PID && sleep 10
24-
- echo no | android create avd -c 50M --force -n testarm -t android-16 --abi armeabi-v7a
25-
- emulator -avd testarm -no-skin -no-audio -no-window &
26-
- EMULATOR_PID=$!
27-
- android-wait-for-emulator
28-
- adb shell input keyevent 82 &
29-
- ./gradlew --info build connectedAndroidTest
17+
- ./runTests.sh

app/app.iml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
7777
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
7878
</content>
79-
<orderEntry type="jdk" jdkName="Android API 20 Platform" jdkType="Android SDK" />
79+
<orderEntry type="jdk" jdkName="Android API 16 Platform" jdkType="Android SDK" />
8080
<orderEntry type="sourceFolder" forTests="false" />
8181
<orderEntry type="library" exported="" name="guava-15.0" level="project" />
8282
<orderEntry type="library" exported="" name="dagger-1.2.2" level="project" />

runTests.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
echo no | android create avd -c 50M --force -n testx86 -t android-16 --abi x86
4+
emulator -avd testx86 -no-skin -no-audio -no-window &
5+
EMULATOR_PID=$!
6+
adb wait-for-device
7+
./wait_for_emulator
8+
adb shell input keyevent 82 &
9+
./gradlew --info build connectedAndroidTest
10+
kill -9 $EMULATOR_PID && sleep 10

wait_for_emulator

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
# Originally written by Ralf Kistner <[email protected]>, but placed in the public domain
4+
5+
set +e
6+
7+
bootanim=""
8+
failcounter=0
9+
until [[ "$bootanim" =~ "stopped" ]]; do
10+
bootanim=`adb -e shell getprop init.svc.bootanim 2>&1`
11+
echo "$bootanim"
12+
if [[ "$bootanim" =~ "not found" ]]; then
13+
let "failcounter += 1"
14+
sleep 5
15+
if [[ $failcounter -gt 100 ]]; then
16+
echo "Failed to start emulator"
17+
exit 1
18+
fi
19+
fi
20+
sleep 1
21+
done
22+
echo "Done"

0 commit comments

Comments
 (0)