SlideShare ist ein Scribd-Unternehmen logo
1 von 15
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Ähnlich wie Bring Back the Fun to Testing Android Apps with Robolectric

Selenium IDE and Beyond
Selenium IDE and BeyondSelenium IDE and Beyond
Selenium IDE and BeyondSamit Badle
 
Hands-on React Native: From Zero to Hero
Hands-on React Native: From Zero to HeroHands-on React Native: From Zero to Hero
Hands-on React Native: From Zero to HeroAll Things Open
 
Hands on React Native: From Zero to Hero
Hands on React  Native:  From Zero to HeroHands on React  Native:  From Zero to Hero
Hands on React Native: From Zero to HeroDmitry Vinnik
 
The First Wave of IoT—Blood in the Water
The First Wave of IoT—Blood in the WaterThe First Wave of IoT—Blood in the Water
The First Wave of IoT—Blood in the WaterJosiah Renaudin
 
Simplifying your test runs with „Make“
Simplifying your test runs with „Make“Simplifying your test runs with „Make“
Simplifying your test runs with „Make“Benjamin Bischoff
 
Discover Android Wear
Discover Android WearDiscover Android Wear
Discover Android WearTroy Miles
 
44CON 2014 - Researching Android Device Security with the Help of a Droid Arm...
44CON 2014 - Researching Android Device Security with the Help of a Droid Arm...44CON 2014 - Researching Android Device Security with the Help of a Droid Arm...
44CON 2014 - Researching Android Device Security with the Help of a Droid Arm...44CON
 
Use Scrum and Continuous Delivery to innovate like crazy!
Use Scrum and Continuous Delivery to innovate like crazy!Use Scrum and Continuous Delivery to innovate like crazy!
Use Scrum and Continuous Delivery to innovate like crazy!Peter Gfader
 
Webinar on How to use MyAppConverter
Webinar on How to use  MyAppConverterWebinar on How to use  MyAppConverter
Webinar on How to use MyAppConverterJaoued Ahmed
 
Basic iPad Training Session for VIU Forestry Students
Basic iPad Training Session for VIU Forestry StudentsBasic iPad Training Session for VIU Forestry Students
Basic iPad Training Session for VIU Forestry StudentsMichael Paskevicius
 
AtlasCamp 2013: Bring your own Stack
AtlasCamp 2013: Bring your own Stack AtlasCamp 2013: Bring your own Stack
AtlasCamp 2013: Bring your own Stack colleenfry
 
Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully Applitools
 
Rewrite or Refactor That Is the Question - DecompileD 2021
Rewrite or Refactor That Is the Question - DecompileD 2021Rewrite or Refactor That Is the Question - DecompileD 2021
Rewrite or Refactor That Is the Question - DecompileD 2021Vladimir Jovanovic
 
Hey You Got Your TDD in my SQL DB by Jeff McKenzie
Hey You Got Your TDD in my SQL DB by Jeff McKenzieHey You Got Your TDD in my SQL DB by Jeff McKenzie
Hey You Got Your TDD in my SQL DB by Jeff McKenzieQA or the Highway
 
Continuous Delivery & DevOps in the Enterprise
Continuous Delivery & DevOps in the EnterpriseContinuous Delivery & DevOps in the Enterprise
Continuous Delivery & DevOps in the EnterpriseEberhard Wolff
 
Continuous Integration, the minimum viable product
Continuous Integration, the minimum viable productContinuous Integration, the minimum viable product
Continuous Integration, the minimum viable productJulian Simpson
 
Vim Plugin Deployment
Vim Plugin DeploymentVim Plugin Deployment
Vim Plugin Deployment偉格 高
 
selenium-2-mobile-web-testing
selenium-2-mobile-web-testingselenium-2-mobile-web-testing
selenium-2-mobile-web-testinghugs
 
Getting started with Octopus Deploy
Getting started with Octopus DeployGetting started with Octopus Deploy
Getting started with Octopus DeployKaroline Klever
 
UPA Boston 2012: My iPhone or Yours? Usability testing on mobile devices
UPA Boston 2012: My iPhone or Yours? Usability testing on mobile devicesUPA Boston 2012: My iPhone or Yours? Usability testing on mobile devices
UPA Boston 2012: My iPhone or Yours? Usability testing on mobile devicesLis Pardi
 

Ähnlich wie Bring Back the Fun to Testing Android Apps with Robolectric (20)

Selenium IDE and Beyond
Selenium IDE and BeyondSelenium IDE and Beyond
Selenium IDE and Beyond
 
Hands-on React Native: From Zero to Hero
Hands-on React Native: From Zero to HeroHands-on React Native: From Zero to Hero
Hands-on React Native: From Zero to Hero
 
Hands on React Native: From Zero to Hero
Hands on React  Native:  From Zero to HeroHands on React  Native:  From Zero to Hero
Hands on React Native: From Zero to Hero
 
The First Wave of IoT—Blood in the Water
The First Wave of IoT—Blood in the WaterThe First Wave of IoT—Blood in the Water
The First Wave of IoT—Blood in the Water
 
Simplifying your test runs with „Make“
Simplifying your test runs with „Make“Simplifying your test runs with „Make“
Simplifying your test runs with „Make“
 
Discover Android Wear
Discover Android WearDiscover Android Wear
Discover Android Wear
 
44CON 2014 - Researching Android Device Security with the Help of a Droid Arm...
44CON 2014 - Researching Android Device Security with the Help of a Droid Arm...44CON 2014 - Researching Android Device Security with the Help of a Droid Arm...
44CON 2014 - Researching Android Device Security with the Help of a Droid Arm...
 
Use Scrum and Continuous Delivery to innovate like crazy!
Use Scrum and Continuous Delivery to innovate like crazy!Use Scrum and Continuous Delivery to innovate like crazy!
Use Scrum and Continuous Delivery to innovate like crazy!
 
Webinar on How to use MyAppConverter
Webinar on How to use  MyAppConverterWebinar on How to use  MyAppConverter
Webinar on How to use MyAppConverter
 
Basic iPad Training Session for VIU Forestry Students
Basic iPad Training Session for VIU Forestry StudentsBasic iPad Training Session for VIU Forestry Students
Basic iPad Training Session for VIU Forestry Students
 
AtlasCamp 2013: Bring your own Stack
AtlasCamp 2013: Bring your own Stack AtlasCamp 2013: Bring your own Stack
AtlasCamp 2013: Bring your own Stack
 
Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully
 
Rewrite or Refactor That Is the Question - DecompileD 2021
Rewrite or Refactor That Is the Question - DecompileD 2021Rewrite or Refactor That Is the Question - DecompileD 2021
Rewrite or Refactor That Is the Question - DecompileD 2021
 
Hey You Got Your TDD in my SQL DB by Jeff McKenzie
Hey You Got Your TDD in my SQL DB by Jeff McKenzieHey You Got Your TDD in my SQL DB by Jeff McKenzie
Hey You Got Your TDD in my SQL DB by Jeff McKenzie
 
Continuous Delivery & DevOps in the Enterprise
Continuous Delivery & DevOps in the EnterpriseContinuous Delivery & DevOps in the Enterprise
Continuous Delivery & DevOps in the Enterprise
 
Continuous Integration, the minimum viable product
Continuous Integration, the minimum viable productContinuous Integration, the minimum viable product
Continuous Integration, the minimum viable product
 
Vim Plugin Deployment
Vim Plugin DeploymentVim Plugin Deployment
Vim Plugin Deployment
 
selenium-2-mobile-web-testing
selenium-2-mobile-web-testingselenium-2-mobile-web-testing
selenium-2-mobile-web-testing
 
Getting started with Octopus Deploy
Getting started with Octopus DeployGetting started with Octopus Deploy
Getting started with Octopus Deploy
 
UPA Boston 2012: My iPhone or Yours? Usability testing on mobile devices
UPA Boston 2012: My iPhone or Yours? Usability testing on mobile devicesUPA Boston 2012: My iPhone or Yours? Usability testing on mobile devices
UPA Boston 2012: My iPhone or Yours? Usability testing on mobile devices
 

Mehr von Peter Friese

Building Reusable SwiftUI Components
Building Reusable SwiftUI ComponentsBuilding Reusable SwiftUI Components
Building Reusable SwiftUI ComponentsPeter Friese
 
Firebase & SwiftUI Workshop
Firebase & SwiftUI WorkshopFirebase & SwiftUI Workshop
Firebase & SwiftUI WorkshopPeter Friese
 
Building Reusable SwiftUI Components
Building Reusable SwiftUI ComponentsBuilding Reusable SwiftUI Components
Building Reusable SwiftUI ComponentsPeter Friese
 
Firebase for Apple Developers - SwiftHeroes
Firebase for Apple Developers - SwiftHeroesFirebase for Apple Developers - SwiftHeroes
Firebase for Apple Developers - SwiftHeroesPeter Friese
 
 +  = ❤️ (Firebase for Apple Developers) at Swift Leeds
 +  = ❤️ (Firebase for Apple Developers) at Swift Leeds +  = ❤️ (Firebase for Apple Developers) at Swift Leeds
 +  = ❤️ (Firebase for Apple Developers) at Swift LeedsPeter Friese
 
async/await in Swift
async/await in Swiftasync/await in Swift
async/await in SwiftPeter Friese
 
Firebase for Apple Developers
Firebase for Apple DevelopersFirebase for Apple Developers
Firebase for Apple DevelopersPeter Friese
 
Building Apps with SwiftUI and Firebase
Building Apps with SwiftUI and FirebaseBuilding Apps with SwiftUI and Firebase
Building Apps with SwiftUI and FirebasePeter Friese
 
Rapid Application Development with SwiftUI and Firebase
Rapid Application Development with SwiftUI and FirebaseRapid Application Development with SwiftUI and Firebase
Rapid Application Development with SwiftUI and FirebasePeter Friese
 
Rapid Application Development with SwiftUI and Firebase
Rapid Application Development with SwiftUI and FirebaseRapid Application Development with SwiftUI and Firebase
Rapid Application Development with SwiftUI and FirebasePeter Friese
 
6 Things You Didn't Know About Firebase Auth
6 Things You Didn't Know About Firebase Auth6 Things You Didn't Know About Firebase Auth
6 Things You Didn't Know About Firebase AuthPeter Friese
 
Five Things You Didn't Know About Firebase Auth
Five Things You Didn't Know About Firebase AuthFive Things You Didn't Know About Firebase Auth
Five Things You Didn't Know About Firebase AuthPeter Friese
 
Building High-Quality Apps for Google Assistant
Building High-Quality Apps for Google AssistantBuilding High-Quality Apps for Google Assistant
Building High-Quality Apps for Google AssistantPeter Friese
 
Building Conversational Experiences with Actions on Google
Building Conversational Experiences with Actions on Google Building Conversational Experiences with Actions on Google
Building Conversational Experiences with Actions on Google Peter Friese
 
Building Conversational Experiences with Actions on Google
Building Conversational Experiences with Actions on GoogleBuilding Conversational Experiences with Actions on Google
Building Conversational Experiences with Actions on GooglePeter Friese
 
What's new in Android Wear 2.0
What's new in Android Wear 2.0What's new in Android Wear 2.0
What's new in Android Wear 2.0Peter Friese
 
Google Fit, Android Wear & Xamarin
Google Fit, Android Wear & XamarinGoogle Fit, Android Wear & Xamarin
Google Fit, Android Wear & XamarinPeter Friese
 
Introduction to Android Wear
Introduction to Android WearIntroduction to Android Wear
Introduction to Android WearPeter Friese
 
Google Play Services Rock
Google Play Services RockGoogle Play Services Rock
Google Play Services RockPeter Friese
 
Introduction to Android Wear
Introduction to Android WearIntroduction to Android Wear
Introduction to Android WearPeter Friese
 

Mehr von Peter Friese (20)

Building Reusable SwiftUI Components
Building Reusable SwiftUI ComponentsBuilding Reusable SwiftUI Components
Building Reusable SwiftUI Components
 
Firebase & SwiftUI Workshop
Firebase & SwiftUI WorkshopFirebase & SwiftUI Workshop
Firebase & SwiftUI Workshop
 
Building Reusable SwiftUI Components
Building Reusable SwiftUI ComponentsBuilding Reusable SwiftUI Components
Building Reusable SwiftUI Components
 
Firebase for Apple Developers - SwiftHeroes
Firebase for Apple Developers - SwiftHeroesFirebase for Apple Developers - SwiftHeroes
Firebase for Apple Developers - SwiftHeroes
 
 +  = ❤️ (Firebase for Apple Developers) at Swift Leeds
 +  = ❤️ (Firebase for Apple Developers) at Swift Leeds +  = ❤️ (Firebase for Apple Developers) at Swift Leeds
 +  = ❤️ (Firebase for Apple Developers) at Swift Leeds
 
async/await in Swift
async/await in Swiftasync/await in Swift
async/await in Swift
 
Firebase for Apple Developers
Firebase for Apple DevelopersFirebase for Apple Developers
Firebase for Apple Developers
 
Building Apps with SwiftUI and Firebase
Building Apps with SwiftUI and FirebaseBuilding Apps with SwiftUI and Firebase
Building Apps with SwiftUI and Firebase
 
Rapid Application Development with SwiftUI and Firebase
Rapid Application Development with SwiftUI and FirebaseRapid Application Development with SwiftUI and Firebase
Rapid Application Development with SwiftUI and Firebase
 
Rapid Application Development with SwiftUI and Firebase
Rapid Application Development with SwiftUI and FirebaseRapid Application Development with SwiftUI and Firebase
Rapid Application Development with SwiftUI and Firebase
 
6 Things You Didn't Know About Firebase Auth
6 Things You Didn't Know About Firebase Auth6 Things You Didn't Know About Firebase Auth
6 Things You Didn't Know About Firebase Auth
 
Five Things You Didn't Know About Firebase Auth
Five Things You Didn't Know About Firebase AuthFive Things You Didn't Know About Firebase Auth
Five Things You Didn't Know About Firebase Auth
 
Building High-Quality Apps for Google Assistant
Building High-Quality Apps for Google AssistantBuilding High-Quality Apps for Google Assistant
Building High-Quality Apps for Google Assistant
 
Building Conversational Experiences with Actions on Google
Building Conversational Experiences with Actions on Google Building Conversational Experiences with Actions on Google
Building Conversational Experiences with Actions on Google
 
Building Conversational Experiences with Actions on Google
Building Conversational Experiences with Actions on GoogleBuilding Conversational Experiences with Actions on Google
Building Conversational Experiences with Actions on Google
 
What's new in Android Wear 2.0
What's new in Android Wear 2.0What's new in Android Wear 2.0
What's new in Android Wear 2.0
 
Google Fit, Android Wear & Xamarin
Google Fit, Android Wear & XamarinGoogle Fit, Android Wear & Xamarin
Google Fit, Android Wear & Xamarin
 
Introduction to Android Wear
Introduction to Android WearIntroduction to Android Wear
Introduction to Android Wear
 
Google Play Services Rock
Google Play Services RockGoogle Play Services Rock
Google Play Services Rock
 
Introduction to Android Wear
Introduction to Android WearIntroduction to Android Wear
Introduction to Android Wear
 

Kürzlich hochgeladen

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 

Kürzlich hochgeladen (20)

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 

Bring Back the Fun to Testing Android Apps with Robolectric

  • 1. Bring Back the Fun to Testing Android Apps with Robolectric Peter Friese - @peterfriese - http:/ /www.peterfriese.de
  • 2. Bring Back the Fun to Testing Android Apps with Robolectric Peter Friese - @peterfriese - http:/ /www.peterfriese.de
  • 3. Testing Android Apps with Robolectric What’s the problem? Why is Robolectric a solution? Demo Peter Friese - @peterfriese - http:/ /www.peterfriese.de
  • 4. What’s the problem? Peter Friese - @peterfriese - http:/ /www.peterfriese.de
  • 5. What’s the problem? Running tests requires: • Dexing Dexing • Packaging Packaging • Installation on device / emulator Installation Peter Friese - @peterfriese - http:/ /www.peterfriese.de
  • 6. Dexing Packaging Peter Friese - @peterfriese - http:/ /www.peterfriese.de Installation
  • 7. 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
  • 8. There is another problem… protected void onCreate(Bundle savedInstanceState) { throw new RuntimeException("Stub!"); } Peter Friese - @peterfriese - http:/ /www.peterfriese.de
  • 9. 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
  • 10. 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
  • 11. 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
  • 12. 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
  • 13. 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
  • 14. Image credits • Snail - http:/ /www.wallsfeed.com/snail-journey-leaf/ Peter Friese - @peterfriese - http:/ /www.peterfriese.de