kotlinx-kover icon indicating copy to clipboard operation
kotlinx-kover copied to clipboard

Support for Screenshot Tests

Open DenisBronx opened this issue 1 year ago • 3 comments

What is your use-case and why do you need this feature? With the recent release of the compose-screenshot-testing library by Google, I'm wondering if it's possible to integrate screenshot tests into the coverage report.

I understand that instrumented tests aren't supported, but since these screenshot tests are categorized under screenshotTest and function similarly to regular Java tests, could they still be included in the coverage report with minimal tweaks?

Describe the solution you'd like Given that the official task for running these tests is named validateDebugScreenshotTest, I would expect the corresponding Gradle commands to be something like:

  1. koverVerifyDebugScreenshot
  2. koverHtmlReportDebugScreenshot
  3. koverXmlReportDebugScreenshot
  4. ...

I realize this could be a significant change, so if we need to create a custom task to include these tests, that would be perfectly acceptable.

DenisBronx avatar Oct 17 '24 13:10 DenisBronx

This task will be taken into account when migrating to Kotlin Gradle Plugin.

In the future, it will be moved to the Kotlin task tracker, or closed if it loses relevance.

shanshin avatar Jan 03 '25 21:01 shanshin

+1 for this feature request.

More context about screenshot test: with gradle task validateScreenshotTest, there will be test results generated in <module>/build/test-results/validate<sourceSet>ScreenshotTest/ in JUNIT xml format and related binary files, which I think it's suitable for test coverage. Currently I don't see a way to merge them, but in iOS, the snapshot test is being taken as part of UT.

TedaLIEz avatar Jan 15 '25 06:01 TedaLIEz

Is there no way to merge .ic files from a unit-test run and a screenshot-test run?

mformetal avatar Jan 29 '25 15:01 mformetal

August 2025, and still we don't have this ?

anmolverma-nc avatar Aug 16 '25 06:08 anmolverma-nc

August 2025, and still we don't have this ?

Unfortunately, not yet. We are currently working on migrating to Kotlin Gradle Plugin, and the JaCoCo agent will be used. As a result, we will be able to merge coverage with files from other tasks, which will simplify the support of such features.

shanshin avatar Aug 18 '25 12:08 shanshin