Skip to content

Document Spring Boot 4 and JUnit 6 compatibility for Spock Spring module#2308

Open
NikStack20 wants to merge 2 commits intospockframework:masterfrom
NikStack20:docs/boot4-junit6-compatibility
Open

Document Spring Boot 4 and JUnit 6 compatibility for Spock Spring module#2308
NikStack20 wants to merge 2 commits intospockframework:masterfrom
NikStack20:docs/boot4-junit6-compatibility

Conversation

@NikStack20
Copy link

@NikStack20 NikStack20 commented Feb 26, 2026

Reproduced Spring Boot 4 behavior where pure JUnit 6 extensions
(e.g. @EnableWireMock) are not automatically executed in Spock.

Confirmed that adding ru.vyarus:spock-junit6 restores expected behavior.

This PR adds a documentation clarification in the Spring module guide.

Summary by CodeRabbit

  • Documentation
    • Added a new subsection explaining JUnit Platform extension compatibility with Spock and field-level injection.
    • Clarified that Spock does not automatically run arbitrary Jupiter extensions, noted compatibility issues with newer Spring Boot, and documented a workaround (adding an extra test dependency) to bridge Jupiter extension lifecycle into Spock and restore expected integration behavior.

@coderabbitai
Copy link

coderabbitai bot commented Feb 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 20c8309 and 84a4aa5.

📒 Files selected for processing (1)
  • docs/module_spring.adoc
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/module_spring.adoc

📝 Walkthrough

Walkthrough

Adds a documentation subsection "JUnit Platform Extension Compatibility" clarifying that Spock runs on the JUnit Platform but does not automatically execute arbitrary JUnit Jupiter extensions; documents compatibility concerns (e.g., Spring Boot 4) and a workaround: add ru.vyarus:spock-junit6 to bridge Jupiter extension lifecycle into Spock.

Changes

Cohort / File(s) Summary
Documentation
docs/module_spring.adoc
Added subsection "JUnit Platform Extension Compatibility" under shared fields injection explaining that Spock doesn't automatically run arbitrary JUnit Jupiter extensions, notes Spring Boot 4 compatibility concerns, and documents adding ru.vyarus:spock-junit6 as a workaround.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐰 A spec in the meadow, a platform so grand,
Jupiter whispers, yet slips from my hand.
A tiny bridge I hop to and fro,
ru.vyarus:spock-junit6 — now extensions flow! 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Document Spring Boot 4 and JUnit 6 compatibility for Spock Spring module' accurately describes the main change: adding documentation about Spring Boot 4 and JUnit 6 compatibility, which matches the raw summary showing a new documentation subsection about JUnit Platform Extension Compatibility.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps
Copy link

greptile-apps bot commented Feb 26, 2026

Greptile Summary

This PR adds a valuable documentation section clarifying Spring Boot 4 and JUnit 6 extension compatibility with Spock. The documentation explains that pure JUnit 6 extensions (like @EnableWireMock) don't automatically execute in Spock specifications and provides the solution of adding the ru.vyarus:spock-junit6 dependency to bridge the extension lifecycle.

  • Clear explanation of the compatibility issue with JUnit 6 extensions in Spock
  • Provides concrete example (@EnableWireMock from wiremock-spring-boot)
  • Includes practical solution with dependency snippet
  • Well-structured AsciiDoc formatting that fits naturally with existing documentation
  • Minor style issue: missing newline at end of file

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk - it's a documentation-only change that adds helpful compatibility information
  • Score reflects that this is a documentation-only change with clear, accurate technical content that addresses a real compatibility issue. The only minor issue is a missing newline at the end of the file, which is a trivial style concern.
  • No files require special attention

Important Files Changed

Filename Overview
docs/module_spring.adoc Added documentation section explaining Spring Boot 4 JUnit 6 extension compatibility and workaround using spock-junit6 dependency

Last reviewed commit: 20c8309

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

----

This bridges the JUnit 6 extension lifecycle into Spock
and restores expected behavior when using such extensions. No newline at end of file
Copy link

Choose a reason for hiding this comment

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

Missing newline at end of file

Suggested change
and restores expected behavior when using such extensions.
and restores expected behavior when using such extensions.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/module_spring.adoc`:
- Around line 135-153: The doc incorrectly labels `@EnableWireMock` and
`@InjectWireMock` as JUnit 6 extensions; update the "Spring Boot 4 and JUnit 6
Compatibility" section to either remove the recommendation to add
ru.vyarus:spock-junit6 for wiremock-spring-boot, or clarify that
ru.vyarus:spock-junit6 only bridges JUnit Jupiter Extension API (e.g.,
`@ExtendWith`, `@RegisterExtension`) into Spock and is not required for Spring test
annotations like `@EnableWireMock` / `@InjectWireMock` which are handled by Spring's
test framework (and should work with `@SpringBootTest`); verify and state the
specific scenarios where spock-junit6 is actually necessary and adjust the
example dependency suggestion accordingly.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 96ee85c and 20c8309.

📒 Files selected for processing (1)
  • docs/module_spring.adoc

@Vampire
Copy link
Member

Vampire commented Mar 15, 2026

I'm sorry, but I don't think this PR should be merged like this.

It mixes terms up that should not be mixed up and also wrongly uses "expected integration behavior", because if you expect a Jupiter extension to work within Spock, then the expectation is wrong, not the behavior. :-)

Some points:

  • There is nothing like a "JUnit Platform Extension".
  • There is "JUnit Platform" which supports running "Engine"s.
  • One of these Engines is "Jupiter", another one is "Spock".
  • They are siblings and are not related.
  • Any expectation that anything from "Jupiter" works inside "Spock" is simply misguided.
  • This is a general topic, not something specific to the Spring part so should be in the general docs
  • Specific 3rd party extensions should not be listed in the Spock docs, they can go away or break any time or have better alternatives and listing them in the docs somehow suggests that the Spock maintainers sanction and recommend that extension and also that it fully works, which it does not.
  • testImplementation is not correct, it should be testRuntimeOnly, as long as you are not using any of the classes in that dependency directly in your code like annotations or similar

I happen to also have added some words about this topic in this PR which would imho supersede this PR: #2322
Feel free to have a look there and share your thoughts if you have any.

@NikStack20
Copy link
Author

Thanks for the detailed explanation and for pointing out the terminology issues.

You're right that my wording around "JUnit Platform Extension" and the expectation about Jupiter extensions working within Spock was misleading. I appreciate the clarification regarding the relationship between the JUnit Platform, the Jupiter engine, and the Spock engine.

I'll take a look at PR #2322 to understand how this topic is addressed there. If that PR already covers the documentation gap appropriately, I'm happy to close this PR to avoid duplication.

Thanks again for the feedback.

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.

2 participants