Shopify / android-testify

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

Extract ScreenshotConfiguration from ScreenshotRule #267

Closed DanielJette closed 2 years ago

DanielJette commented 2 years ago

What does this change accomplish?

This is the first of many PRs to break down the monolithic ScreenshotRule into a collection of composable, reusable and extensible elements. The ultimate goal is to allow Testify to interoperate with a wider variety of testing methodologies such as JUnit5 and Test Scenarios.

How have you achieved it?

In this PR, I have collected all of the configuration related properties from ScreenshotRule and extracted them to a new interface, ScreenshotConfigurationInterface. I have then employed the delegation pattern to compose ScreenshotRule from ScreenshotConfiguration. The primary outcome from this change is to reduce the size of the ScreenshotRule class and begin the process of more narrowly defining the role and purpose of each aspect of the class. Eventually, all of ScreenshotRule will be replaced with reusable, composable objects.

image

Tophat instructions

There are no expected changes to the public API in this PR. All tests should pass without modification.

Notice

This change must keep main in a shippable state; it may be shipped without further notice.

DanielJette commented 2 years ago

cc @lwise

DanielJette commented 2 years ago

I no longer like this approach. It exposes too many internal state variables through that interface, unintentionally making them visible to the consumer (test) classes. I'd like to split this up so that the internal state variables are not exposed publicly