Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Testing in Android: automatici, di integrazione, TDD e scenari avanzati


Published on

Published in: Technology

Testing in Android: automatici, di integrazione, TDD e scenari avanzati

  1. 1. Who am I 32 years old happy software developer Mobile addicted Android enthusiastic Free software fan … and Tiramisu' lover rainbowbreeze
  2. 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. 3. Setup the environment
  4. 4. Test with Junit 3 <ul><li>Create a class that extends TestCase </li></ul><ul><li>Code first test
  5. 5. Run it! </li></ul>
  6. 6. Test with special Android Mock AndroidTestCase (mock context, MoreAsserts)
  7. 7. Test with special Android Mock ApplicationTestCase (mock context)
  8. 8. Test with special Android Mock ActivityInstrumentationTestCase2 (mock intent) ActivityUnitTestCase (mock context and application) SingleLaunchActivityTestCase (single environment thru tests) ViewAsserts (extended asserts)
  9. 9. Test with special Android Mock ProviderTestCase2 (mock ontext and application, MockContentResolver)
  10. 10. Test with special Android Mock ServiceTestCase (mock context and application) test the service lifecycle, not the logic (detached)
  11. 11. Test with special Android Mock MockApplication, MockContext, MockContentProvider (API8), MockCursor (API8), MockDialogInterface, MockPackageManager, MockResources MockContentResolver, IsolatedContext
  12. 12. Android monkey adb shell monkey -p -v 500
  13. 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
  14. 14. Robotium Automatic black-box test cases for Android applications Your applications or black-box apk
  15. 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
  16. 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. 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. 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! ;)