Add support for repeatable annotations for local extensions (#1030)#1118
Add support for repeatable annotations for local extensions (#1030)#1118leonard84 merged 4 commits intospockframework:masterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1118 +/- ##
============================================
+ Coverage 75.74% 75.93% +0.18%
- Complexity 3619 3641 +22
============================================
Files 392 392
Lines 10997 11089 +92
Branches 1348 1369 +21
============================================
+ Hits 8330 8420 +90
+ Misses 2192 2190 -2
- Partials 475 479 +4 Continue to review full report at Codecov.
|
|
Here the actual repeatable annotations can be looked at if wanted: Vampire/spock@repeatable-annotations...repeatable-annotations-combined#files_bucket |
3beaaad to
969093f
Compare
602810d to
86d9a5d
Compare
cfaf735 to
07bddf5
Compare
07bddf5 to
78b09fb
Compare
40f515c to
d3dc91c
Compare
d3dc91c to
3cc468a
Compare
3cc468a to
15e87f8
Compare
...pecs/src/test/groovy/org/spockframework/smoke/extension/RepeatableLocalExtensionsSpec.groovy
Outdated
Show resolved
Hide resolved
spock-core/src/main/java/org/spockframework/runtime/extension/RepeatedExtensionAnnotations.java
Show resolved
Hide resolved
| def "should work properly on feature"() { | ||
| expect: | ||
| runner.runSpec """ | ||
| ${buildContainer(contained, containerWithList)} |
There was a problem hiding this comment.
If find these tests really hard to read, since you basically have to execute the template code in your head to get an idea of what the actual test looks like.
There was a problem hiding this comment.
How do you suggest that I improve it?
Being very verbose and long in the where block having the annotations there manually written and hard to read properly?
Adding some comments to what the test does?
I tried to write easy to understand and read and at the same time concise tests.
The where table specifies how many individual annotations, how many contained in the container annotation manually and if one whether directly or inside a list to use and how many extension calls are expected.
There was a problem hiding this comment.
I would think about generating the tests based on the code you already have and commit both. I think this where DAMP is more important than DRY explanation
There was a problem hiding this comment.
I don't think committing both makes too much sense, because the next person will change the generated code not even being aware of the source, the next person after that might again be aware of the source, change the source and re-generate, overwriting the first other persons changes and so on.
I though the numbers actually are DAMP.
For example
individual | contained | containerWithList || expected
1 | 2 | true || 3
means 1 individual annotation without container, two annotations in the container and the container value as list should result in 3 times the extension executed.
I actually inteded this to be actually good readable. :-(
There was a problem hiding this comment.
For me the test is very hard to read and it took me a while to find out what happens.
Nevertheless I must admit that I don't have a better solution for this scenario, I have to think about it.
Javadoc for buildContainer (some samples what could be generated) and for RepeatableLocalExtensionsSpec (that the test uses a dummy extension to check the behaviour) would help for sure.
There was a problem hiding this comment.
I added a bit of JavaDoc to hopefully make the tests clearer and easier to interpret :-)
spock-core/src/main/java/org/spockframework/runtime/ExtensionRunner.java
Show resolved
Hide resolved
6c3b86f to
15007c8
Compare
spock-core/src/main/java/org/spockframework/runtime/ExtensionRunner.java
Show resolved
Hide resolved
Yes, I was fully aware of what you meant. |
6c3b86f to
9808cd1
Compare
This change is