Shopify / android-testify

Add screenshots to your Android tests
https://testify.dev
MIT License
231 stars 23 forks source link

ActivityTestRule deprecated #244

Closed oradkovsky closed 2 years ago

oradkovsky commented 2 years ago

Is your feature request related to a problem? Please describe. Please share any plans regarding moving away from using https://developer.android.com/reference/androidx/test/rule/ActivityTestRule.html due to deprecation.

This feedback relates to:

Describe the solution you'd like The plugin heavily relies on https://developer.android.com/reference/androidx/test/rule/ActivityTestRule.html, while latter being deprecated.

Describe alternatives you've considered Using whatever coming instead of https://developer.android.com/reference/androidx/test/rule/ActivityTestRule.html

Additional context NA

DanielJette commented 2 years ago

@oradkovsky Thank you for the feedback

My expectation is that we will migrate the existing ScreenshotRule to either leverage ActivityScenario or possibly ActivityScenarioRule. I'm not anticipating that ActivityTestRule will be removed from the Android SDK for some time, so I expect that there will be time to develop a quality solution for Testify.

However, this will likely introduce a significant change to the API and "lifecycle" of Testify, so my plan would be to introduce an alternative non-ActivityTestRule-based solution side-by-side with the existing mechanism, to allow users to transition over without making a big, breaking change all at once. We did something like this with the transition from JUnit3 to JUnit4.

As for specific plans, I would hope we could get something added to a 1.2 release, but that really depends on how different/breaking a scenario-based Testify is.

Are there any specific problems or blockers you're running into right now with the current implementation? Maybe there's something quicker we can do to help rather than waiting on this specific fix.

oradkovsky commented 2 years ago

All of the statements above fully make sense to me (not that it matters though :) . My problem is that we already have set of UI tests working on top of ActivityScenario. So far I do not see easy way of using existing Testify solution for this (by easy - I mean with slight code modifications of Testify).

DanielJette commented 2 years ago

Yeah, OK, I underhand how that would be a blocker for you. I've been very interested in splitting out the core Testify functionality into a more modular architecture so that it could be plugged into multiple testing patterns. Like, reusing the same core login from either a Rule or a Scenario. Now that 1.1.0 is in RC, we're going to start working on the 1.2.0 backlog tickets very soon. Hopefully it won't be too long until we can cut an alpha build with ActivityScenario support.

@oradkovsky If you're interested, you could open a PR against the Sample app where you add a test using ActivityScenario that looks like what you're using on your own project. I'm thinking something like that could demonstrate the kind of testing you're doing currently and then we can develop a Testify solution that would work well with that kind of test specifically.

allefsousa commented 2 years ago

@DanielJette first of all congratulations for the amazing work. Any predictions about the integration with ActivityScenario? that will be fantastic

DanielJette commented 2 years ago

Moved to https://github.com/ndtp/android-testify/issues/88