Skip to content

Add paparazzi-junit4-reporting for Gradle test report image attachments#2299

Draft
joshfriend wants to merge 1 commit intocashapp:masterfrom
joshfriend:jfriend/gradle-junit4-report-attachments
Draft

Add paparazzi-junit4-reporting for Gradle test report image attachments#2299
joshfriend wants to merge 1 commit intocashapp:masterfrom
joshfriend:jfriend/gradle-junit4-report-attachments

Conversation

@joshfriend
Copy link
Copy Markdown

Closes #2263

Introduces a new paparazzi-junit4-reporting artifact: a JUnit Platform engine wrapper (paparazzi-vintage) that intercepts EngineExecutionListener to call fileEntryPublished() for every snapshot PNG, surfacing images in Gradle 9.4+ test reports. The Paparazzi plugin auto-applies this new dependency and excludes the junit-vintage engine.

Introduces a new `paparazzi-junit4-reporting` artifact: a JUnit Platform
engine wrapper (`paparazzi-vintage`) that intercepts `EngineExecutionListener`
to call `fileEntryPublished()` for every snapshot PNG, surfacing images in
Gradle 9.4+ test reports and build scans.

Core changes:
- `PaparazziReportingBridge`: thread-local callback bridge between `Paparazzi`
  and the engine wrapper; set per-test by the engine, cleared after each test
- `Paparazzi.reportOutputFile()`: fires `PaparazziReportingBridge.publishFile()`
  after every snapshot/gif write
- `PaparazziVintageTestEngine`: wraps `VintageTestEngine` with a distinct engine
  ID (`"paparazzi-vintage"`); the standard `junit-vintage` engine is excluded
  automatically by the Paparazzi Gradle plugin when `paparazzi-junit4-reporting`
  is detected on the test classpath, so tests don't run twice
- `PaparazziPlugin`: detects `paparazzi-junit4-reporting` in declared dependencies
  and auto-configures `useJUnitPlatform { excludeEngines("junit-vintage") }`
- Gradle wrapper updated to 9.4.0 (required for `fileEntryPublished` support)
// paparazzi-vintage can attach snapshot images to the Gradle HTML test report
when (val opts = test.options) {
is TestNGOptions -> { /* Don't override TestNG test runner */ }
is JUnitPlatformOptions -> opts.excludeEngines("junit-vintage")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

considering #2209, should jupiter be also handled?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support attaching snapshot images to Gradle test results

3 participants