Skip to content

Instrumentation 1.0.0

Compare
Choose a tag to compare

The new instrumentation libraries are here! πŸŽ‰πŸŽ‰πŸŽ‰

dependencies {
  androidTestImplementation "de.mannodermaus.junit5:android-test-core:1.0.0"
  androidTestRuntimeOnly "de.mannodermaus.junit5:android-test-runner:1.0.0"
}

(More info regarding the setup can be found in the README, and shortly on the Wiki. Also, please allow some time for the new artifacts to become available on JCenter - their submission is currently pending.)

Getting to know the new libraries

The integration of JUnit 5 into Android instrumentation tests has never been easier. We introduce a new core library, and a revamped runner to execute the new tests on supported devices!

  • The best news upfront: The high minSdkVersion requirement has been removed. Of course, JUnit 5 tests will still only run on devices with supported software (i.e. Android 8.0/API 26 or higher). However, you won't need to create custom flavors to host your tests any longer. If you execute a test suite containing JUnit 5 tests on an older device, the test runner will simply ignore the new tests.

  • @ActivityTest is deprecated. With Google's push towards a unified testing API, the new JUnit 5 core library for Android tests has also migrated to the new ActivityScenario API. There is an extension which you can drop into your classes, granting access to an underlying scenario, very much like the ActivityScenarioRule would do.

  • The "old" instrumentation library is now deprecated. Please use android-test-core from now on!