Introduce a new instrumentation library #155
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ref #151
The new way of writing unified tests on Android comes through the
ActivityScenario
API. It's pretty much what used to be theActivityTestRule
(and in fact, this successor also has an accompanying JUnit 4 Rule).Our current instrumentation library, centered around the
@ActivityTest
annotation and theTested<T>
type, is a blatant copy-and-paste of theActivityTestRule
, and doesn't have the greatest futureproofing because of that. With the new scenario API, the functionality of the old rule is now isolated into its own agnostic class, which makes it really easy to connect test frameworks to it!This PR introduces a JUnit 5 implementation for the
ActivityScenario
, which will replace the old way of writing instrumentation tests. Furthermore, this new approach is going to be provided through a brand-new artifact, which we can consider the first step towards supporting Robolectric tests with JUnit 5 (as soon as they figure out how to do the classloading, that is...).The KDoc on
ActivityScenarioExtension
describes how the API is used. Also, there are test classes demonstrating the integration. It's basically the same as JUnit 4 Rules, but with@RegisterExtension
instead of@Rule
andActivityScenarioExtension
instead ofActivityScenarioRule
.