Build MethodSource with the correct spec class name.#1345
Build MethodSource with the correct spec class name.#1345leonard84 merged 7 commits intospockframework:masterfrom
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/junit-framework@8856b48 |
leonard84
left a comment
There was a problem hiding this comment.
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=MyChildSpecNo tests will run. Ultimately this is because Spock reports a test plan to Junit5 wherein the test 'some test' belongs to
MyParentSpecinstead 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.