paparazzi icon indicating copy to clipboard operation
paparazzi copied to clipboard

Decouple snapshot tests from unit tests.

Open KatieBarnett opened this issue 1 year ago • 12 comments

I would like to be able to just run the snapshot tests and not also the unit tests. On my project's CI we have parallel build workflows to run verifications and tests and I would like the snapshot tests to run on a parallel workflow and not require the unit tests to have run first (so they can be run separately).

I have been able to exclude the snapshot tests from the general unit test task using the following:

afterEvaluate {
    if (!(props["runSpecificUnitTestsOnly"] as Boolean)) {
        tasks.named<Test>("testAlphaDebugUnitTest") {
            dependsOn(getModuleTaskList("feature", "testDebugUnitTest"))
            dependsOn(getModuleTaskList("base", "testDebugUnitTest"))
            filter {
                // Exclude snapshot tests - they will be run separately as part of verifyPaparazzi
                excludeTestsMatching("*.snapshot.*")
            }
        }
    }
}

I have also tried to just run the snapshot tests using ./gradlew recordPaparazziAlphaDebug --tests "*.snapshot.*" but it is not really achieving what I want.

KatieBarnett avatar Nov 20 '23 03:11 KatieBarnett