Skip to content

Instantly share code, notes, and snippets.

@8th-Light-Blog
Created June 28, 2011 18:37
Show Gist options
  • Save 8th-Light-Blog/1051833 to your computer and use it in GitHub Desktop.
Save 8th-Light-Blog/1051833 to your computer and use it in GitHub Desktop.
Blog Title: Up and running with TDD on Android (Part 2)
Author: Colin Jones
Date: July 11th, 2009
$ cd ..
$ ant debug && adb install -r bin/TicTacToe-debug.apk
$ cd tests
$ ant debug && adb install -r bin/TicTacToe-debug.apk
$ adb shell am instrument -w com.colinwjones.tests/android.test.InstrumentationTestRunner
com.colinwjones.TicTacToeTest:
Failure in testNewGameButtonExists:
junit.framework.AssertionFailedError: expected:<new game> but was:<>
<Button android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/new_button"
android:text="New Game" />
$ cd ..
$ ant debug && adb install -r bin/TicTacToe-debug.apk
$ cd tests
$ ant debug && adb install -r bin/TicTacToe-debug.apk
$ adb shell am instrument -w com.colinwjones.tests/android.test.InstrumentationTestRunner
Test results for InstrumentationTestRunner=..
Time: 1.009
OK (2 tests)
<target name="clean">
<delete includeemptydirs="true">
<fileset dir="bin" includes="**/*" />
<fileset dir="tests/bin" includes="**/*" />
</delete>
</target>
<target depends="clean, debug" name="test">
<property environment="env" />
<property name="android-tools" value="${env.ANDROID_TOOLS}" />
<ant dir="tests" antfile="build.xml" inheritall="false" target="debug" />
<exec executable="${android-tools}/adb" failonerror="true">
<arg line="install -r bin/TicTacToe-debug.apk" />
</exec>
<exec executable="${android-tools}/adb" failonerror="true">
<arg line="install -r tests/bin/TicTacToe-debug.apk" />
</exec>
<exec executable="${android-tools}/adb">
<arg line="shell am instrument" />
<arg value="-w" />
<arg line="com.colinwjones.tests/android.test.InstrumentationTestRunner" />
</exec>
</target>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment