• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Bring Back the Fun to Testing Android Apps with Robolectric
 

Bring Back the Fun to Testing Android Apps with Robolectric

on

  • 5,261 views

A short introduction why Robolectric will make testing more fun on Android and how to set it up in Eclipse.

A short introduction why Robolectric will make testing more fun on Android and how to set it up in Eclipse.

Statistics

Views

Total Views
5,261
Views on SlideShare
1,083
Embed Views
4,178

Actions

Likes
3
Downloads
5
Comments
0

14 Embeds 4,178

http://www.peterfriese.de 4112
http://lanyrd.com 34
http://localhost 14
http://www.google.de 3
http://webcache.googleusercontent.com 2
http://feedreader.com 2
http://inoreader.com 2
http://www.linkedin.com 2
http://plus.url.google.com 2
https://www.google.dk 1
https://www.google.hr 1
http://www.google.be 1
http://wtanaka.com 1
http://www.google.co.in 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

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.

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

    Bring Back the Fun to Testing Android Apps with Robolectric Bring Back the Fun to Testing Android Apps with Robolectric Presentation Transcript

    • Bring Back the Fun to Testing Android Apps with Robolectric Peter Friese - @peterfriese - http:/ /www.peterfriese.de
    • Bring Back the Fun to Testing Android Apps with Robolectric Peter Friese - @peterfriese - http:/ /www.peterfriese.de
    • Testing Android Apps with Robolectric What’s the problem? Why is Robolectric a solution? Demo Peter Friese - @peterfriese - http:/ /www.peterfriese.de
    • What’s the problem? Peter Friese - @peterfriese - http:/ /www.peterfriese.de
    • What’s the problem? Running tests requires: • Dexing Dexing • Packaging Packaging • Installation on device / emulator Installation Peter Friese - @peterfriese - http:/ /www.peterfriese.de
    • Dexing Packaging Peter Friese - @peterfriese - http:/ /www.peterfriese.de Installation
    • Robolectric to the rescue! Run tests in a regular JVM, not on Dalvik VM • Dexing • Packaging • Installation on device / emulator Peter Friese - @peterfriese - http:/ /www.peterfriese.de
    • There is another problem… protected void onCreate(Bundle savedInstanceState) { throw new RuntimeException("Stub!"); } Peter Friese - @peterfriese - http:/ /www.peterfriese.de
    • Robolectric Solution: Shadow Objects • Intercept class loading • Rewrite method bodies (using ASM) • Intercept calls to Android classes, record state in shadow classes Peter Friese - @peterfriese - http:/ /www.peterfriese.de
    • FEST - Readability for Your Tests Plain JUnit: assertEquals(View.GONE, textView.getVisibility()); ! java.lang.AssertionError: expected:<8> but was:<0> FEST: assertThat(textView).isGone(); ! java.lang.AssertionError: Expected to be gone but was visible Peter Friese - @peterfriese - http:/ /www.peterfriese.de
    • Demo See http:/ /www.peterfriese.de/unit-testing-android-apps-with-robolectric-and-eclipse/ for a step-by-step description of how to set up Robolectric in Eclipse Peter Friese - @peterfriese - http:/ /www.peterfriese.de
    • Electrified? Here’s where to get Robolectric / FEST Web: http:/ /ww.robolectric.org Github: https:/ /github.com/robolectric/robolectric Peter Friese - @peterfriese - http:/ /www.peterfriese.de Web: http:/ /square.github.io/fest-android/ Github: https:/ /github.com/square/fest-android
    • Contact Peter Friese ter.friese@zuhlke.com pe ! td Zuhlke Engineering L 43 Whitfield St London W1T 4HD ! +44 7825 688 244 Peter Friese - @peterfriese - http:/ /www.peterfriese.de
    • Image credits • Snail - http:/ /www.wallsfeed.com/snail-journey-leaf/ Peter Friese - @peterfriese - http:/ /www.peterfriese.de
    • The End