-
Notifications
You must be signed in to change notification settings - Fork 470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build MethodSource with the correct spec class name. #1345
Build MethodSource with the correct spec class name. #1345
Conversation
Can you add tests for this, maybe by using the |
5b13c23
to
ffeedc5
Compare
That’s tough — the problem is in the interaction between Spock, Junit, and Surefire. The class that doesn’t handle Spock’s metadata is private in the Surefire package so I can’t use it in a test.
I pushed a commit with the test, but I had to copy+paste the Surefire plugin’s filter into my test.
The test does fail when run against the code in master, and pass in my branch.
… On Jun 10, 2021, at 3:21 PM, Leonard Brünings ***@***.***> wrote:
Can you add tests for this, maybe by using the EngineTestKit ?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#1345 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AH3HHZHTXAMS6ZZZ4NTGPPLTSEGD5ANCNFSM46O5NJAA>.
|
ffeedc5
to
5d8f0cb
Compare
5d8f0cb
to
6d701f8
Compare
Codecov Report
@@ Coverage Diff @@
## master #1345 +/- ##
=============================================
+ Coverage 0 79.20% +79.20%
- Complexity 0 3940 +3940
=============================================
Files 0 408 +408
Lines 0 12253 +12253
Branches 0 1616 +1616
=============================================
+ Hits 0 9705 +9705
- Misses 0 1967 +1967
- Partials 0 581 +581
Continue to review full report at Codecov.
|
This is a bug in the surefire plugin that has to be fixed there I think.
|
Here the PR that fixed it in Gradle: gradle/gradle#15943 |
Good point @Vampire, I completely forgot about that issue with gradle. |
I talked with @marcphilipp again, and he corrected is statement from the other PR and mentioned this commit junit-team/junit5@8856b48 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've simplified the PR and removed the maven dependency, while preserving the effect of the maven test filter in the test.
spock-testkit/src/test/groovy/spock/platform/SpockEngineBase.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Marc Philipp <marc@gradle.com>
Thanks @milo2048 |
The combination of Spock, Junit5, and the maven Surefire plugin prevents tests from running if they're inherited from a parent class.
Consider this scenario:
Run command line with:
mvn -Dtest=MyChildSpec
No tests will run. Ultimately this is because Spock reports a test plan to Junit5 wherein the test 'some test' belongs to
MyParentSpec
instead ofMyChildSpec
, and the Surefire plugin then filters out the test.The same kind of inheritance scenario with a pure Junit5 test works as expected.
From the JUnit5 docs for
MethodSource
:Therefore I believe that Spock should be reporting 'some test' as belonging to
MyChildSpec
.With the supplied patch, the tests run through maven/surefire.