update: Aug 9, 2017
I encountered no tests found error when running tests with AssertJ and AndroidJUnitRunner1.0.0.
https://stackoverflow.com/questions/45402645/instrumented-tests-failure-with-androidjunitrunner-1-0-0-and-assertj
A few days ago, Android Testing Support Library 1.0 was released.
I pick up some awesome stuff for me, and I think this release will help enhance test automation for other 3rd party libraries.
- https://android-developers.googleblog.com/2017/07/android-testing-support-library-10-is.html
- https://developer.android.com/topic/libraries/testing-support-library/release-notes.html
IdlingResources
- https://developer.android.com/reference/android/support/test/espresso/IdlingRegistry.html
com.android.support.test.espresso:espresso-idling-resource:3.0.0
help synchronise against
- Executors
com.android.support.test.espresso.idling:idling-concurrent:3.0.0
- network requests and responses
com.android.support.test.espresso.idling:idling-net:3.0.0
New view matchers/actions/methods
- Read the release note:
Parameterised testing
- JUnitParams for Parameterised test based on
AndroidJUnitTestRunner- https://github.com/Pragmatists/JUnitParams
ParameterizedRobolectricTestRunneris for Robolectic- https://github.com/junit-team/junit4/wiki/parameterized-tests haven’t supported yet.
- But, I think
JUnitParamsis enough for an alternative solution.
- But, I think
GrantPermissionRule
- Make Espresso test easy especially permission grant related feature.
- We can control the permissions in source code level
- https://developer.android.com/reference/android/support/test/rule/GrantPermissionRule.html
Understand how to write/think test for Android
- https://developer.android.com/training/testing/index.html
- Testing sections come to developer.android.com.
- We can see many helpful tools such as
dumpsysfrom there.
Android Test Orchestrator
Runner related command options
-e classLoader – Provide the ability to pass class loaders using runner args-e filter – Add support for custom JUnit filters to be specified using runner args-e runnerBuilder – Allows developers to provide their own implementations of RunnerBuilder that can determine whether and how they can run against a specific class
2 Comments