Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a new instrumentation library #155

Merged
merged 7 commits into from
Mar 18, 2019

Conversation

mannodermaus
Copy link
Owner

@mannodermaus mannodermaus commented Mar 17, 2019

Ref #151

The new way of writing unified tests on Android comes through the ActivityScenario API. It's pretty much what used to be the ActivityTestRule (and in fact, this successor also has an accompanying JUnit 4 Rule).

Our current instrumentation library, centered around the @ActivityTest annotation and the Tested<T> type, is a blatant copy-and-paste of the ActivityTestRule, 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 and ActivityScenarioExtension instead of ActivityScenarioRule.

No further development will take place here, as the testing model
for Android moves to a unified approach through ActivityScenario.
There’s going to be a new artifact addressing this new API.
@mannodermaus mannodermaus self-assigned this Mar 17, 2019
@mannodermaus mannodermaus merged commit 3226b13 into master Mar 18, 2019
@mannodermaus mannodermaus deleted the feature/new-instrumentation-library branch March 18, 2019 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant