The document discusses various techniques for testing Android applications including:
1) Setting up the testing environment and using JUnit 3 to write and run basic tests.
2) Using Android-specific testing frameworks like AndroidTestCase, ActivityInstrumentationTestCase2, and ProviderTestCase2 that provide mocks of Android components and contexts.
3) Leveraging the Android monkey tool and monkeyrunner to simulate user interactions for testing.
4) Adopting external test automation frameworks like Robotium for black-box testing or Robolectric for test-driven development.
5) Developing an advanced automated testing framework involving XML test case files, a customized InstrumentationTestRunner, and a Robot and CommandRunner to drastically reduce testing time.
Testing in Android: automatici, di integrazione, TDD e scenari avanzati
1. Who am I 32 years old happy software developer Mobile addicted Android enthusiastic Free software fan … and Tiramisu' lover rainbowbreeze
2. Overview Setup the environment Test with Junit 3 Test with special Android mocks Android monkey and monkeyrunner External libraries: Robotium TDD with Robolectric Example of advanced scenario
3. Setup the environment http://developer.android.com/guide/topics/testing/testing_android.html
6. Test with special Android Mock AndroidTestCase (mock context, MoreAsserts) http://developer.android.com/reference/android/test/AndroidTestCase.html http://developer.android.com/reference/android/test/MoreAsserts.html http://developer.android.com/reference/android/test/IsolatedContext.html
7. Test with special Android Mock ApplicationTestCase (mock context) http://developer.android.com/reference/android/test/ApplicationTestCase.html
8. Test with special Android Mock ActivityInstrumentationTestCase2 (mock intent) ActivityUnitTestCase (mock context and application) SingleLaunchActivityTestCase (single environment thru tests) ViewAsserts (extended asserts) http://developer.android.com/guide/topics/testing/activity_testing.html http://developer.android.com/resources/tutorials/testing/activity_test.html http://developer.android.com/reference/android/test/ViewAsserts.html
9. Test with special Android Mock ProviderTestCase2 (mock ontext and application, MockContentResolver) http://developer.android.com/guide/topics/testing/contentprovider_testing.html
10. Test with special Android Mock ServiceTestCase (mock context and application) test the service lifecycle, not the logic (detached) http://developer.android.com/guide/topics/testing/service_testing.html
11. Test with special Android Mock MockApplication, MockContext, MockContentProvider (API8), MockCursor (API8), MockDialogInterface, MockPackageManager, MockResources MockContentResolver, IsolatedContext
13. Android monkeyrunner monkeyrunner writing programs that control an Android device or emulator from outside of Android code. With monkeyrunner, you can write a Python program that installs an Android application or test package, runs it, sends keystrokes to it, takes screenshots of its user interface, and stores screenshots on the workstation http://developer.android.com/guide/developing/tools/monkeyrunner_concepts.html
14. Robotium Automatic black-box test cases for Android applications Your applications or black-box apk http://code.google.com/p/robotium/
15. TDD with Robolectric Robolectric is a unit test framework that de-fangs the Android SDK jar so you can test-drive the development of your Android app. TDD also for Android (yuppi)! Shadow objects (stock and custom) Integrable with RoboGuice for IoC/DI http://pivotal.github.com/robolectric/
16. Example of advanced scenario Created a framework for test automation Now QA write XML files corresponding to specific test cases Drastic time redution: from days to 30 minutes Free software! Link to website
17. Example of advanced scenario Complex and boring test cases to verify upon each release of the product / user stories Android / Blackberry / iPhone tests Junit for logic, but for server integration / different OSes capabilites?
18. Example of advanced scenario Redefined InstrumentationTestRunner, the new one load xml files and all the tests resources Robot and CommandRunner Xml files define tests to execute It's code, so... Let's the fun begin! ;) https://android-client.forge.funambol.org/