Testing in Android: automatici, di integrazione, TDD e scenari avanzati
Upcoming SlideShare
Loading in...5

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






Total Views
Views on SlideShare
Embed Views



7 Embeds 842

http://www.rainbowbreeze.it 821
http://lanyrd.com 13
http://feeds.feedburner.com 4
http://a0.twimg.com 1
http://www.linkedin.com 1
http://webcache.googleusercontent.com 1
http://www.verious.com 1



Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.


11 of 1

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

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

    • Who am I 32 years old happy software developer Mobile addicted Android enthusiastic Free software fan … and Tiramisu' lover rainbowbreeze
    • 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
    • Setup the environment http://developer.android.com/guide/topics/testing/testing_android.html
    • Test with Junit 3
      • Create a class that extends TestCase
      • Code first test
      • Run it!
    • 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
    • Test with special Android Mock ApplicationTestCase (mock context) http://developer.android.com/reference/android/test/ApplicationTestCase.html
    • 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
    • Test with special Android Mock ProviderTestCase2 (mock ontext and application, MockContentResolver) http://developer.android.com/guide/topics/testing/contentprovider_testing.html
    • 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
    • Test with special Android Mock MockApplication, MockContext, MockContentProvider (API8), MockCursor (API8), MockDialogInterface, MockPackageManager, MockResources MockContentResolver, IsolatedContext
    • Android monkey adb shell monkey -p your.package.name -v 500 http://developer.android.com/guide/developing/tools/monkey.html http://developer.android.com/guide/developing/tools/monkeyrunner_concepts.html
    • 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
    • Robotium Automatic black-box test cases for Android applications Your applications or black-box apk http://code.google.com/p/robotium/
    • 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/
    • 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
    • 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?
    • 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/