-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Document that @BeforeAll & @AfterAll are unsupported in @Nested test classes #88
Comments
This commit comments out @BeforeAll/@afterall declarations in @nested test classes until issue #88 is resolved. Issue: #88 ------------------------------------------------------------------------ On behalf of the community, the JUnit Lambda Team thanks msg systems ag (http://www.msg-systems.com) for supporting the JUnit crowdfunding campaign! ------------------------------------------------------------------------
@junit-team/junit-lambda, this is a gotcha that we will need to discuss amongst the group. |
I see several options. No need for desperation ;) The simplest thing might just be to disallow @Before/AfterAll in nested tests since nested tests IMO are a means to group tests by their domain context not by their technical context. If someone really really needs a before/afterAll for technical reasons, they can easily use an extension. |
Resolve in |
After reading through this and trying to look at the other issues, does it still make sense that |
@sbrannen a valid position against And, considering that during I know there exists the SpringExtension, however, this only works on the test instance, and the static versions of both |
@sbrannen and i do not see why we would need the Scenario abstraction as proposed by #48. the latter seems to be a poor man's implementation of what cucumber already provides. And we do not need such functionality in the core. The main reason for
So here, the concrete test class' setUp method will override the base test class' method. And given the new feature of nested tests, why not extend this feature to nested tests also? Traversing the inheritance hierarchy from top to bottom first, level by level, resolving all static versions of And this should also encompass extensions, which would then always provide their And if the user messes up, who cares? Either they get it or they don't. So, in the above example, the before all / after all would be called in the following fashion
Having such a feature will allow us to use auto wired instances of either configurations a/o services a/o components during both instance level tear down and set up without us having to provide for such mechanisms at the static level, requiring additional and mostly redundant code. |
Hi @silkentrance, For starters, this issue was only pertinent to the Alpha release of JUnit 5 and was closed on Jan 20, 2016 (over two years ago). More importantly, this issue was superseded by #419 which was closed on Jun 30, 2017. Thus, it has been possible to have non-static Please inform yourself of the status quo in JUnit Jupiter 5.0.x, and if you have further concerns please open a new issue to address them. I will now lock this conversation since it pertains to an outdated version of the framework. |
Status Quo
Since support for configuring the test instance lifecycle was dropped after the prototype,
@BeforeAll
and@AfterAll
methods are now required to bestatic
. Consequently such methods can no longer be used in@Nested
test classes. Any attempt to do so will result in a compilation error similar to the following.See the nested test classes in
com.example.HierarchyTestCase
for concrete examples.Deliverables
@BeforeAll
and@AfterAll
methods in nested test classes.@BeforeAll
and@AfterAll
are unsupported in nested test classes.com.example.HierarchyTestCase
.The text was updated successfully, but these errors were encountered: