-
Notifications
You must be signed in to change notification settings - Fork 21
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
Spock tests are executing @BeforeEach but not @AfterEach #157
Comments
This was actually very easy to fix just by changing the TestingSupportExtension. Essentially we just need to prepend the BeforeEach to the setupMethods and then add a block to handle the AfterEach. I will also add handlers for the BeforeAll and AfterAll. That should provide a nice compatibility layer between Spock and JUnit5 when using Grails 5. I will submit a PR shortly. |
longwa
added a commit
to longwa/grails-testing-support
that referenced
this issue
Nov 14, 2021
…ng similar to JUnit 4/Spock ordering
longwa
added a commit
to longwa/grails-testing-support
that referenced
this issue
Nov 14, 2021
jdaugherty
pushed a commit
to jdaugherty/grails-testing-support
that referenced
this issue
Sep 25, 2024
…ng similar to JUnit 4/Spock ordering
jdaugherty
pushed a commit
to jdaugherty/grails-testing-support
that referenced
this issue
Sep 25, 2024
jdaugherty
pushed a commit
to jdaugherty/grails-testing-support
that referenced
this issue
Sep 26, 2024
…ng similar to JUnit 4/Spock ordering
jdaugherty
pushed a commit
to jdaugherty/grails-testing-support
that referenced
this issue
Sep 26, 2024
jdaugherty
pushed a commit
to jdaugherty/grails-testing-support
that referenced
this issue
Sep 26, 2024
…ng similar to JUnit 4/Spock ordering
jdaugherty
added a commit
to jdaugherty/grails-testing-support
that referenced
this issue
Sep 26, 2024
…ng similar to JUnit 4/Spock ordering
jdaugherty
added a commit
to jdaugherty/grails-testing-support
that referenced
this issue
Sep 26, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Some of the extensions provided in this library are causing specs to execute methods annotated with JUnit5's
@BeforeEach
but not@AfterEach.
I'm not sure if this library is trying to emulate the
@BeforeEach
or if it's just something leftover, but the current behavior is not super useful.Critically, the ordering of the calls is different than in Grails 4.0, i.e it used to be:
Now the ordering is:
This makes it difficult to use
@BeforeEach
in a trait or base class as usually you will want that to be called first (which it used to be). Also, Spock makes it difficult since traits can't usesetup()
if the test class also has a setup method.IMO, this library should implement an extension that creates compatibility with Before* and After* annotations while keeping the test order consistent with pre-5.0 behavior (and what would be considered the sensical ordering)
The text was updated successfully, but these errors were encountered: