Test

Testing in Android.
Latest Update Current Stable Release Next Release Candidate Beta Release Alpha Release
August 25, 2020 1.3.0 - - -

Feedback

Your feedback helps make Jetpack better. Let us know if you discover new issues or have ideas for improving this library. Please take a look at the existing issues in this library before you create a new one. You can add your vote to an existing issue by clicking the star button.

Create a new issue

See the Issue Tracker documentation for more information.

Version 1.3.0

Version 1.3.0

August 25, 2020

This is the stable release of AndroidX Test 1.3.0. It contains updates to the following libraries:

  • Core 1.3.0
  • Espresso 3.3.0
  • Intents 3.3.0
  • JUnit 1.1.2
  • Monitor 1.3.0
  • Orchestrator 1.3.0
  • Runner 1.3.0
  • Rules 1.3.0
  • Truth 1.3.0
  • Test Services 1.3.0

There are no changes since 1.3.0-rc03. Here is a summary of the changes since the 1.2.0 release:

New Features

  • Support filtering by prerelease SDKs via SdkSuppress#codeName
  • Add truth extensions for Location
  • Add truth assertions for Bundle string and parceable arrays.
  • Support ActivityOptions in ActivityScenario
  • Make activity lifecycle transition timeout configurable
  • Handle Activities launched via implicit intents. (Fixes #496)
  • Add a BundleMatchers.isEmpty() and isEmptyOrNull() methods
  • Allow Intents.release without Intents.init
  • Add ViewMatchers.isFocused()

API Changes

  • ActivityTestRule is deprecated in favor of ActivityScenario/ActivityScenarioRule
  • Allow subclasses of ServiceTestRule to customize timeout

Bug Fixes

  • Fix filtering parameterized methods
    • This also fixes running parameterized tests with Orchestrator [#215, https://issuetracker.google.com/119838413]
  • Fix 'runtime permission dialog appears' when running on API 29
  • Skip starting and finish animations for the empty activity used in ActivityScenario. (Fixes #411)
  • Handle Activities launched via implicit intents. (Fixes #496)
  • Make kotlin package names unique, fixing log spam when building with AGP 4.1 [#680]
  • Only delegate to RobolectricTestRunner in AndroidJUnit4 runner if its on the classpath
  • Espresso contrib: Replace usages of RecyclerView.findViewHolderForPosition method with its replacement
  • Fix NoSuchMethodError when testing with AccessibilityChecks enabled (#376)
  • Fix the error message when Espresso is busy due to processing messages rather than idling resources
  • ViewMatchers.isDisplayingAtLeast() works for views with negative scale.
  • Enhance error messaging for WithIdMatcher
  • Remove spurious wait in waitForAtLeastOneActivityToBeResumed.
  • Set correct meta state for ACTION_UP
  • Fix missing missing androidx_test_espresso_contrib_drawer_layout_tag field [#671]
  • Improve class path scanning error handling in AndroidJUnitRunner: Ignore all no class found and linkage errors (Fixes #439)
  • Initialize InstrumentationRegistry before creating RunListeners from RunnerArgs

Dependency Changes

  • Truth: Update to com.google.truth:truth:1.0 and com.google.guava:guava:27.0.1-android

Version 1.3.0-rc03

August 5, 2020

This is the third release candidate of AndroidX Test 1.3.0. It contains updates to the following libraries:

  • Core 1.3.0-rc03
  • Espresso 3.3.0-rc03
    • Remove some not-yet-ready-for-release APIs that were mistakenly included in previous rc+beta builds
  • Intents 3.3.0-rc03
    • Remove some not-yet-ready-for-release APIs that were mistakenly included in previous rc+beta builds
  • JUnit 1.1.2-rc03
  • Monitor 1.3.0-rc03
  • Orchestrator 1.3.0-rc03
  • Runner 1.3.0-rc03
  • Rules 1.3.0-rc03
  • Truth 1.3.0-rc03
  • Test Services 1.3.0-rc03

Version 1.3.0-rc02

July 28, 2020

This is the second release candidate of AndroidX Test 1.3.0. It contains updates to the following libraries:

  • Core 1.3.0-rc02
    • Make kotlin package names unique, fixing log spam when building with AGP 4.1 [#680]
  • Espresso 3.3.0-rc02
    • Fix missing missing androidx_test_espresso_contrib_drawer_layout_tag field [#671]
  • Intents 3.3.0-rc02
  • JUnit 1.1.2-rc02
  • Monitor 1.3.0-rc02
  • Orchestrator 1.3.0-rc02
  • Runner 1.3.0-rc02
  • Rules 1.3.0-rc02
    • Add conversion tips for ActivityTestRule->ActivityScenario
  • Truth 1.3.0-rc02
  • Test Services 1.3.0-rc02

Version 1.3.0-rc01

May 28, 2020

This is a release candidate of AndroidX Test 1.3.0. It contains updates to the following libraries:

  • Core 1.3.0-rc01
  • Espresso 3.3.0-rc01
    • Make package names unique, fixing log spam when building with AGP 4.1 [#573]
  • Intents 3.3.0-rc01
  • JUnit 1.1.2-rc01
  • Monitor 1.3.0-rc01
    • Make package names unique, fixing log spam when building with AGP 4.1 [#573]
  • Orchestrator 1.3.0-rc01
  • Runner 1.3.0-beta01
    • Make package names unique, fixing log spam when building with AGP 4.1 [#573]
  • Rules 1.3.0-rc01
    • Make package names unique, fixing log spam when building with AGP 4.1 [#573]
  • Truth 1.3.0-rc01
  • Test Services 1.3.0-rc01

Version 1.3.0-beta02

May 20, 2020

This is a beta release of AndroidX Test 1.3.0. New APIs are unlikely to change. It contains updates to the following libraries:

  • Core 1.3.0-beta02
  • Espresso 3.3.0-beta02
  • Intents 3.3.0-beta02
  • JUnit 1.1.2-beta02
  • Monitor 1.3.0-beta02
  • Orchestrator 1.3.0-beta02
  • Runner 1.3.0-beta01
    • Fix running parameterized tests with Orchestrator [#215, https://issuetracker.google.com/119838413]
  • Rules 1.3.0-beta02
  • Truth 1.3.0-beta02
  • Test Services 1.3.0-beta02
    • Fix 'runtime permission dialog appears' when running on API 29

Version 1.3.0-beta01

April 20, 2020

This is a beta release of AndroidX Test 1.3.0. New APIs are unlikely to change. It contains updates to the following libraries:

  • Core 1.3.0-beta01
  • Espresso 3.3.0-beta01
    • Add ViewMatchers.isFocused()
    • Enhance error messaging for WithIdMatcher
  • Intents 3.3.0-beta01
    • Allow Intents.release without Intents.init
  • JUnit 1.1.2-beta01
  • Monitor 1.3.0-beta01
  • Orchestrator 1.3.0-beta01
  • Runner 1.3.0-beta01
    • Only delegate to RobolectricTestRunner if its on the classpath
    • Support filtering by prerelease SDKs via SdkSuppress#codeName
  • Rules 1.3.0-beta01
    • Deprecate ActivityTestRule
  • Truth 1.3.0-beta01
    • Make LocationSubject override isEqualTo
  • Test Services 1.3.0-beta01

Version 1.3.0-alpha05

March 17, 2020

This is an alpha release of AndroidX Test 1.3.0. New APIs are subject to change. It contains updates to the following libraries:

  • Core 1.3.0-alpha05
    • Skip starting and finish animations for the empty activity used in ActivityScenario. (Fixes #411)
    • Handle Activities launched via implicit intents. (Fixes #496)
  • Espresso 3.3.0-alpha05
    • ViewMatchers.isDisplayingAtLeast() works for views with negative scale.
    • Remove spurious wait in waitForAtLeastOneActivityToBeResumed.
    • Set correct meta state for ACTION_UP
  • Intents 3.3.0-alpha05
  • JUnit 1.1.2-alpha05
  • Monitor 1.3.0-alpha05
  • Orchestrator 1.3.0-alpha05
  • Runner 1.3.0-alpha05
    • Ignore all LinkageError exceptions when scanning classpath for tests. (Fixes #439)
    • Initialize InstrumentationRegistry before creating RunListeners from RunnerArgs
  • Rules 1.3.0-alpha05
  • Truth 1.3.0-alpha05
  • Test Services 1.3.0-alpha05

Version 1.3.0-alpha04

February 20, 2020

This is an alpha release of AndroidX Test 1.3.0. New APIs are subject to change. It contains updates to the following libraries:

  • Core 1.3.0-alpha04
  • Espresso 3.3.0-alpha04
    • Fix the error message when Espresso is busy due to processing messages rather than idling resources
  • Intents 3.3.0-alpha04
  • JUnit 1.1.2-alpha04
  • Monitor 1.3.0-alpha04
  • Orchestrator 1.3.0-alpha04
  • Runner 1.3.0-alpha04
    • Fix AndroidJUnitRunner to report a test as failure if a StrictMode violation occurs
    • Add additional info when JUnit4 test class is malformed for easier diagnostics
  • Rules 1.3.0-alpha04
  • Truth 1.3.0-alpha04
  • Test Services 1.3.0-alpha04
    • Include the test storage service in the test services

Here's a full list of commits contained in version 1.3.0-alpha04.

Version 1.3.0-alpha03

December 3, 2019

This is an alpha release of AndroidX Test 1.3.0. New APIs are subject to change. It contains updates to the following libraries:

  • Core 1.3.0-alpha03
    • Support ActivityOptions in ActivityScenario
  • Espresso 3.3.0-alpha03
    • Fix NoSuchMethodError when testing with AccessibilityChecks enabled (#376)
  • Intents 3.3.0-alpha03
  • JUnit 1.1.2-alpha03
  • Monitor 1.3.0-alpha03
  • Orchestrator 1.3.0-alpha03
  • Runner 1.3.0-alpha03
    • Ignore NoClassDefFoundErrors when performing classpath scanning for tests
    • Add better error handling on unhandled exceptions
    • Allowing opting out of 'waitForActivitiesToComplete' via a runner argument
  • Rules 1.3.0-alpha03
  • Truth 1.3.0-alpha03
    • Update Location extensions to behave better with nulls.
    • Add stringArrayList and parcelableArrayList methods to BundleSubject

Version 1.2.1

Version 1.2.1-alpha02

July 15, 2019

This is an alpha release of AndroidX Test 1.2.1. New APIs are subject to change. It contains updates to the following libraries:

  • Core 1.2.1-alpha02
    • Make activity lifecycle transition timeout configurable
  • Espresso 3.3.0-alpha02
  • Intents 3.3.0-alpha02
    • Add a BundleMatchers.isEmpty() and isEmptyOrNull() methods
  • JUnit 1.1.2-alpha02
  • Monitor 1.3.0-alpha02
  • Orchestrator 1.3.0-alpha02
  • Runner 1.3.0-alpha02
  • Rules 1.3.0-alpha02
  • Truth 1.3.0-alpha02
    • Update to com.google.truth:truth:1.0 and com.google.guava:guava:27.0.1-android

Version 1.2.1-alpha01

June 17, 2019

This is an alpha release of AndroidX Test 1.2.1. New APIs are subject to change. It contains updates to the following libraries:

  • Core 1.2.1-alpha01
    • Includes toolchain fix for 'Invalid parameter counts in MethodParameter attributes' build warning
  • Espresso 3.3.0-alpha01
    • contrib: Replace usages of RecyclerView.findViewHolderForPosition method with its replacement
  • Intents 3.3.0-alpha01
  • JUnit 1.1.2-alpha01
  • Monitor 1.3.0-alpha01
  • Orchestrator 1.3.0-alpha01
  • Runner 1.3.0-alpha01
  • Rules 1.3.0-alpha01
    • Allow subclasses of ServiceTestRule to customize timeout
  • Truth 1.3.0-alpha01
    • Add truth extensions for Location

Version 1.2.0

Version 1.2.0

May 29, 2019

This is the stable release of AndroidX Test 1.2.0. It contains updates to the following libraries:

  • Core 1.2.0
  • Espresso 3.2.0
  • Intents 3.2.0
  • JUnit 1.1.1
  • Monitor 1.2.0
  • Orchestrator 1.2.0
  • Runner 1.2.0
  • Rules 1.2.0
  • Truth 1.2.0

Version 1.2.0-beta01

May 6, 2019

This is an beta release of AndroidX Test 1.2.0. It contains updates to the following libraries:

  • Core 1.2.0-beta01
    • More gracefully handle situations where multiple ActivityScenarios are used in a test
  • Espresso 3.2.0-beta01
  • Intents 3.2.0-beta01
  • JUnit 1.1.1-beta01
  • Monitor 1.2.0-beta01
    • Instrumentation.runOnMainSync() propogates exceptions back to calling thread
  • Orchestrator 1.2.0-beta01
  • Runner 1.2.0-beta01
  • Rules 1.2.0-beta01
  • Truth 1.2.0-beta01

Version 1.2.0-alpha05

April 30, 2019

This is an alpha release of AndroidX Test 1.2.0. New APIs are subject to change. It contains updates to the following libraries:

  • Core 1.2.0-alpha05
    • Make ActivityScenario#onActivity callable from the main thread
  • Espresso 3.2.0-alpha05
    • More deflaking of openActionBarOverflowOrOptionsMenu
  • Intents 3.2.0-alpha05
  • JUnit 1.1.1-alpha05
  • Monitor 1.2.0-alpha05
  • Orchestrator 1.2.0-alpha05
  • Runner 1.2.0-alpha05
  • Rules 1.2.0-alpha05
  • Truth 1.2.0-alpha05
    • update to upstream google Truth 0.44

Version 1.2.0-alpha04

April 18, 2019

This is an alpha release of AndroidX Test 1.2.0. New APIs are subject to change. It contains updates to the following libraries:

  • Core 1.2.0-alpha04
  • Espresso 3.2.0-alpha04
    • Deflake openActionBarOverflowOrOptionsMenu
    • Add hook in androidx.test to simulate a window focus changed for local test environments
  • Intents 3.2.0-alpha04
  • JUnit 1.1.1-alpha04
  • Monitor 1.2.0-alpha04
  • Orchestrator 1.2.0-alpha04
  • Runner 1.2.0-alpha04
    • Make androidx.test work if legacy android.test classes are not present
  • Rules 1.2.0-alpha04
  • Truth 1.2.0-alpha04

Version 1.2.0-alpha03

April 7, 2019

This is an alpha release of AndroidX Test 1.2.0. New APIs are subject to change. It contains updates to the following libraries:

  • Core 1.2.0-alpha03
    • Add getState() API to ActivityScenario
  • Espresso 3.2.0-alpha03
    • Convert WithTagKeyMatcher to accept Matcher<?> instead of Matcher
    • Update link to espresso setup docs
    • Fix debug logging when running in different locales
  • Intents 3.2.0-alpha03
  • JUnit 1.1.1-alpha03
  • Monitor 1.2.0-alpha03
    • Another attempt at clearing exception handler to prevent memory leaks in Robolectric.
  • Orchestrator 1.2.0-alpha03
  • Runner 1.2.0-alpha03
    • Add a tests_regex AJUR option to run tests matching a given regular expression.
  • Rules 1.2.0-alpha03
  • Truth 1.2.0-alpha03
    • Expose the ParcelableSubject API
    • Add BundleSubject#longInt
    • Add IntentSubject#hasComponent

Version 1.1.1

Version 1.1.1-alpha02

March 7, 2019

This is an alpha release of AndroidX Test 1.1.1. New APIs are subject to change. It contains updates to the following libraries:

  • Espresso 3.2.0-alpha02
  • Intents 3.2.0-alpha02
    • Add IntentMatchers#filterEquals
    • Fix activity lifecycle timing bug in Intents#intended(). It now idles main looper before checking activity state.
  • Runner 1.1.2-alpha02
    • Allow specifying both package and class filters.
  • Truth 1.2.0-alpha02
  • JUnit 1.1.1-alpha02
  • Core 1.1.1-alpha02
    • Throw a RuntimeException when Activity cannot be resolved.
  • Monitor 1.1.2-alpha02
    • Clear reference to uncaught exception handler to prevent memory leaks in Robolectric.
  • Rules 1.1.2-alpha02
  • Orchestrator 1.1.2-alpha02

Version 1.1.1-alpha01

January 30, 2019

This is an alpha release of AndroidX Test 1.1.1. New APIs are subject to change. It contains updates to the following libraries:

  • Espresso 3.1.2-alpha01
    • Added method AccessibilityChecks.disable().
  • Intents 3.1.2-alpha01
    • Add IntentMatchers#hasDataString
    • Fix activity lifecycle timing bug in Intents#intended(). It now idles main looper before checking activity state.
  • Runner 1.1.2-alpha01
    • AndroidJUnitRunner now accepts comma separated class list in -e annotation option, for running only tests with all of the given annotations
  • Truth 1.1.1-alpha01
    • Add filtersEquallyTo() to IntentSubject for comparison of intents using Intent.filterEquals().
  • JUnit 1.1.1-alpha01
  • Core 1.1.1-alpha01
  • Monitor 1.1.2-alpha01
  • Rules 1.1.2-alpha01
  • Orchestrator 1.1.2-alpha01

Version 1.1.0

Version 1.1.0

December 13, 2018

This is the stable release of AndroidX Test 1.1.0. It contains updates to the following libraries:

  • Espresso 3.1.1
  • Runner 1.1.1
  • Rules 1.1.1
  • Monitor 1.1.
  • AndroidTestOrchestrator 1.1.1
  • Core 1.1.0
  • Truth 1.1.0
  • JUnit 1.1.0

  • Core 1.1.0

    • Make ActivityScenario support activities which start another activity

Version 1.1.0-beta01

December 6, 2018

This is the beta01 release of AndroidX Test 1.1.0. It contains updates to the following libraries:

  • Core 1.1.0-beta01
    • New core-ktx kotlin extension artifact! Includes a kotlin-friendly ActivityScenario.launchActivity API
    • New ActivityScenario API for launching activities with custom intents
    • New ActivityScenario API for receiving an Activity result
    • Make ActivityScenario closeable
  • Espresso3.1.1-beta01
    • Modify withResourceNameMatcher and HumanReadables to be API 28 compatible.
    • Update ReplaceTextAction's description to include the stringToBeSet
    • Support Espresso in Robolectric paused looper mode.
  • JUnit 1.1.0-beta01
    • New ActivityScenarioRule API, for auto-launching and closing an Activity on test setup and teardown
    • New junit-ktx kotlin extension artifact! Includes a kotlin-friendly ActivityScenarioRule API
  • Runner 1.1.1-beta01
    • Make -e package and -e testFile consistent in behavior when receiving packages
  • Truth 1.1.0-beta01
    • Add bool, parcelable, and parcelableAsType BundleSubject APIs
  • Rules 1.1.1-beta01
  • Monitor 1.1.1-beta01
  • AndroidTestOrchestrator 1.1.1-beta01

Version 1.0.0

Version 1.0.0

October 24, 2018

  • All libraries
    • Set minSdkVersion to 14 and targetSdkVersion to 28
  • Espresso 3.1.0
    • Fix withContentDescription to work with non-string types
    • Add support for using Espresso on Robolectric
    • Issue 73044169: Espresso ViewMatchers.withText doesn't work when textAllCaps is enabled
    • Add support for injecting a sequence of motion events
  • Intents
    • Add beta API for retrieving list of intents. Intended for use with new truth assertions
  • Runner 1.1.0
    • Add support for instant apps
    • Deprecate androidx.test.runner.AndroidJUnit4 and replace with androidx.test.ext.junit.runners.AndroidJUnit4
  • Monitor 1.1.0
    • Deprecate androidx.test.InstrumentationRegistry and replace with androidx.test.platform.app.InstrumentationRegistry and androidx.test.core.app.ApplicationProvider
  • AndroidTestOrchestrator 1.1.0
    • Only enable orchestrator coverage handling if both 'coverage' and 'coverageFilePath' arguments are passed.
    • Only wait for debugger when the -debug is set but not for listing ATO test cases. A new orchestratorDebug flag was added for debugging orchestrator itself
  • Core 1.0.0
    • New artifact! Includes new APIs that support both local and on-device tests for:
      • Retrieving context: ApplicationProvider
      • Controlling activity lifecycles: ActivityScenario(beta)
      • Builders for MotionEvent, PackageInfo
      • Parceables utility class
  • Truth 1.0.0
    • New artifact! Includes custom truth subjects for Notification, Intent, Bundle, Parcelable, and MotionEvent
  • JUnit 1.0.0
    • New artifact! Includes JUnit runner class androidx.test.ext.junit.runners.AndroidJUnit4 that supports both local and on-device tests.