-
-
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
API for intercepting execution #1145
Comments
@hwellmann Thanks for raising this issue! Would you only want to intercept the execution of the test method or of other test class method and extensions as well? |
Other test class methods (like those annotated with Rather than intercepting individual methods, it might be more convenient to intercept the execution of an entire node (including all children and extensions). |
Do the test driver and test container run in the same JVM? |
Not necessarily, containers may be local or remote. |
How does the test driver communicate to the container what should be executed, especially when they run in different JVMs? |
That's the job of the extension, that's nothing I'd expect from JUnit. For Java EE, we use a servlet to tunnel test requests and listener events over HTTP. For OSGi, we open a server socket. For JUnit 4, it was enough for the request to include a class name, method name and optionally a position index for parameterized tests to identify the test(s) to be executed. |
@hwellmann, does the |
Closing due to lack of activity. Please reopen if the issue persists. |
Overview
With the present
BeforeAll, BeforeEach, AfterEach, AfterAll
extensions, it is possible to decorate test execution, but it is not possible to fully intercept it.This is required for test frameworks like Pax Exam or Arquillian which currently use JUnit 4 runners as a test driver to first start a test container (e.g. a Java EE server or an OSGi framework) and then delegate test execution to an agent running within the container.
At the moment, the only way I see to implement equivalent functionality with JUnit 5 would be a custom test engine, which would require a lot of code duplication from
junit-jupiter-engine
since most potential hooks for overriding are package private or final.In particular, I would like to override
HierarchicalTestEngine.execute()
orNode.before(), Node.execute(), Node.after()
.A JUnit extension should be able to determine whether is is running under the (outer) test driver or in the (inner) test container. When running in the container, execution should proceed as normal. When running under the driver, execution should be delegated to the container via a suitable communication channel (e.g. a servlet request) provided by the extension.
The text was updated successfully, but these errors were encountered: