Skip to content

API for intercepting execution #1145

@hwellmann

Description

@hwellmann

Overview

  • (X) Feature request.

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() or Node.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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions