Created
June 28, 2011 18:56
-
-
Save 8th-Light-Blog/1051899 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Blog Title: Up and running with TDD on Android (Part 1) | |
Author: Colin Jones | |
Date: July 11th, 2009 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ android create project -t 1 -p tictactoe-android -a TicTacToe -k com.colinwjones | |
$ cd tictactoe-android |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ android list avd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ android create avd -n ColinPhone -t 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ emulator -avd ColinPhone & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ant debug | |
$ adb install -r bin/TicTacToe-debug.apk | |
$ cd tests | |
$ ant debug | |
$ adb install -r bin/TicTacToe-debug.apk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ adb shell am instrument -w com.colinwjones.tests/android.test.InstrumentationTestRunner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// with imports at top: | |
import import android.widget.Button; | |
/* some code | |
* ... | |
* ... | |
*/ | |
// inside your test class: | |
public void testNewGameButtonExists() throws InterruptedException | |
{ | |
Button button = (Button) getActivity().findViewById(R.id.new_button); | |
assertEquals("New Game", button.getText()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ant debug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Button android:layout_width="fill_parent" | |
android:layout_height="wrap_content" | |
android:id="@+id/new_button" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment