The Android development tools provide developers with a host of tools for creating fun, useful and compelling Android applications. Included in this tool-set are various testing tools that make it easier to ensure the quality of the applications. One tool that has been missing, however, is a mocking framework.
Objects Mocking is a common technique in the tester’s skillset. Mocks are simulated objects which mimic and take the place of real objects by replaying pre-recorded behavior. They are used to quickly build more focused tests that reflect better the behavior of the tested objects. This is achieved by breaking long object construction chains, isolating interesting behavior to tighten a test’s focus. “Mocking” various services such as a network connection, a database or even a per-use credit card charging service (the kind you don’t want to stress-test with your personal credit card number!) makes it possible to test real external interactions without ever touching the real thing.
Here at Google, we use mocking frameworks a lot when writing Java tests (for the reasons above, and more) but unfortunately, the solutions available only provide limited mocking capabilities for Android testing.
That is, until now:
Android Mock has been written as an extension of EasyMock to allow for the mocking of Java Interfaces and Classes on Android’s Dalvik VM. Check out the resources for how to use it and how to write tests, then get mocking.
Wednesday, 26 May 2010
expect(easier testing).andReturn(Android Mock)
Recent Posts
- New Google Tricks: 15+ Cool and Amazing Secret Hidden Google Tricks
- Weekend Tech News: Battlegrounds Mobile India gameplay, WhatsApp policy canceled?, OPPO foldable phone
- PUBG Mobile India release date: Relaunching as Battlegrounds Mobile India officially announced
- Difference B/W Blogs & Websites Things People Haven't Told You
- Watch Live IPL 2021: How to watch today's Live streaming of IPL 2021? All Methods
Related tricks
- Teaching with Mobile
- Introducing CityHash
- Now Playing: the YouTube Symphony Orchestra Augmented Reality Experiment
- Use Google Apps APIs without writing a program
- 5 Apps To Control Your LED Lighting
- Setup, Install and Run Ubuntu/Linux OS on Android's Galaxy S III Smartphone - Tutorial and Guide
- Download, Install and Flash Android 4.1.1 Jelly Bean On Nexus S (i9023/i9020/i9020T/i9020A) Devices - Tutorial
- How to: Turn Off and Disable Apps Notification In Android 4.1 Jelly Bean Devices - Tutorial
- How to Be a Successful Mobile eCommerce App Developer - Be a Game Changer
- expect(easier testing).andReturn(Android Mock)
- Cauliflower Vest: end-to-end OS X FileVault 2 recovery key escrow solution
(+)