import org.junit.runners.Parameterized // annotation @Parameterized.Parameters@RunWith(ParameterizedCrossLibraryScreenshotTestRunner::class)classMyParameterizedCrossLibraryScreenshotTest(privateval testItem: MyTestItemEnum,) {companionobject {@JvmStatic@Parameterized.ParametersfuntestItemProvider(): Array<MyTestItemEnum> = MyTestItemEnum.values() }@get:Ruleval screenshotRule =defaultCrossLibraryScreenshotTestRule(config = testItem.config)// Optional: Override the default config for the desired libraries .configure(PaparazziConfig(deviceConfig = DeviceConfig.PIXEL_XL) )@CrossLibraryScreenshot// required for Android-Testify@TestfunsnapComposable() { screenshotRule.snapshot(name = testItem.name) {MyComposable() } }}
You must define a testInstrumentationRunner in build.gradle of type androidx.test.runner.AndroidJUnitRunner for Parameterized Cross-Library screenshot tests to work. For instance, com.karumi.shot.ShotTestRunnerif using Shot.