Proper testing procedures are a huge part of software development best practices, particularly automated tests. As many Android developers would point out, the story on Android was far behind the curve for many years, and it was only recently that the tools had caught up with the needs of the ecosystem. Today, Google announced a major leap forward for these tools with an official v1.0 release of the Android Testing Support Library (ATSL).


[EMBED_YT]https://www.youtube.com/watch?v=pK7W5npkhho

[/EMBED_YT]

Many of the new features in this release of the ATSL were discussed in the Test-Driven Development on Android with the Android Testing Support Library talk at Google I/O 2017, but the biggest enhancement comes with a new major version release of Espresso. It has been promoted to v3.0.0 and brings a few new features that make it easier to work with and more robust, including: Multiprocess Espresso to allow testing an app across process boundaries, a new Idling Registry for easier management of resources, and expands the pre-built Idling Resources to include IdlingThreadPoolExecutor and IdlingScheduledThreadPoolExecutor.

Another notable addition is the Android Test Orchestrator, which makes it possible for developers to reset an app environment for the purpose of running tests in isolation from each other. Among other things, this means that if one test causes a crash, it will not interfere with tests later in the process. The Orchestrator is still in beta and has to be used from a command line, but there are plans to add integration with Firebase Test Lab and Android Studio.

Turning to more fine-grained additions, ProviderTestRule has been added to make testing ContentProviders easier in AndroidJUnit4, and there's a new rule called GrantPermissionRule that streamlines the process of testing with the granular permission system introduced in Marshmallow. AndroidJUnitRunner can now also use JUnitParams and configure class loaders and custom test filters.

If you haven't already been using the Android Testing Support Library, check out the instructions for getting started. All of the test-related documentation has recently been moved out of Github and organized in a permanent home at developers.android.com/testing. For a more thorough list of changes and additions, check out Google's blog post and the release notes.

Source: Android Developers Blog