Skip to content
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

JUnit 5 driver and Java EE mode [PAXEXAM-792] #886

Open
ops4j-issues opened this issue Apr 30, 2016 · 1 comment
Open

JUnit 5 driver and Java EE mode [PAXEXAM-792] #886

ops4j-issues opened this issue Apr 30, 2016 · 1 comment
Labels
Milestone

Comments

@ops4j-issues
Copy link

Harald Wellmann created PAXEXAM-792

Goals

  • There is a new driver module pax-exam-junit5.
  • Users can write and run simple Java EE tests like
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.ops4j.pax.exam.invoker.junit5.PaxExam;
import org.ops4j.pax.exam.util.Transactional;

@ExtendWith(PaxExam.class)
public class AuthorTest {

    @Test
    @Transactional
    public void shouldCreateAuthor() {
        // ...
    }
}
  • There are some regression tests (simple, non-parameterized tests) which run in the integration test suite on all supported Java EE servers.

Fixed in: 5.0.0
Votes: 1, Watches: 1

@ops4j-issues
Copy link
Author

Harald Wellmann commented

JUnit 5 does provide lots of extension points, but as of release 5.0.1, it is not possible to intercept a test method invocation, you can only decorate with before or after callbacks.

A Pax Exam driver must be able to intercept a test class or method execution and delegate it to a proxy driver running within the test container. I've raised a JUnit issue for that: junit-team/junit5#1145

Until that is fixed, we will have to use our own test engine. Unfortunately, all potential places where I'd like to hook into junit-jupiter-engine are package private or final, so it is not possible to use this library as a dependency and override some methods.

For now, pax-exam-junit5-engine is based on the source code of org.junit.jupiter:junit-jupiter-engine:5.0.1, with some modifications mainly in HierarchicalTestEngine and HierarchicalTestExecutor. renamed to PaxExamTestEngine and PaxExamTestExecutor.

This is just a first step, for keeping in sync with JUnit 5, we'd better use the Maven Dependency Plugin to download the original sources as part of our build process and only include added or modified source files in our source tree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant