Testing Espresso Matchers
If you are using instrumentation tests in your Android app, it is likely that you are using During your day-by-day as a developer you will eventually implement some custom views. However, The example we will follow is the implementation of a custom
The `LoadingButton` in non-loading and loading states
For the sake of simplicity I’m not going to focus on the implementation of the
2. Creating the When creating a custom
In our example we would do as follows:
In this case we would use An important point is that I actually made this class We would then define a public
3. Creating the Test In order to test this matcher in with a fast approach and with no need to run instrumentation tests, we will leverage The idea is that we will use Below you can see that we are testing the behavior of
The magic happens on The internals of
Set of helpers to inflate a single View and launch in the context of a Fragment Scenario.
If we then run our tests and, the output on Android Studio will be the following:
You can see that it has a initial overheard time spent, but after that the tests run really fast. And the more tests you have the less the overhead will be noticeable in the full test run time. To finalize I just wanted to briefly show how we would use our new
You can find a sample project describing this example here. References:
Android News
Compose CameraX on Android
By Peng Jiang Android new UI toolkit Jetpack compose is in beta now, which has all the features you need to build production-ready apps. CameraX is another Jetpack support library, which let you control the camera easier. As compose is still under development, lots of the views are still not available the compose way.
By
ProAndroidDev -
droidcon News
Tech Showcases, Developer Resources & Partners
EmployerBrandingHeader
jobs.droidcon.com
![]() Latest Android Jobs
Kotlin Weekly
![]() Your weekly dose of Kotlin
ProAndroidDev
![]() Android Tech Blogs, Case Studies and Step-by-Step Coding
Zalando
![]() Meet one of Berlin's top employers
Academy for App Success
![]() Google Play resources tailored for the global droidcon community |
Droidcon is a registered trademark of Mobile Seasons GmbH Copyright © 2020. All rights reserved.