Support for JUnit5

Hi all,

Since there is no work being done yet to support JUnit5, I started something on my own. I was able to create a Junit 5 extension, which runs a simple test in an Arquillian container.

Here is my POC on github: GitHub - OndrejM/arquillian-junit5-hacks: POC for arquillian and junit5

It contains the Junit5 extension and a simple test to demonstrate it’s working. If you want to run the tests, use maven profile arquillian-payara-embedded to run them in embedded payara (all is executed in the same JVM, but the tests in the container are executed in a different http request thread - it’s easy to debug in one go).

I still have a big issue to overcome: JUnit 5 still runs the tests also outside arquillian, so the test code (including before/after hooks) is executed twice - as a plain Junit 5 test and also in Arquillian (from a beforeEach JUnit5 hook). It’s similar to how TestNG arquillian tests run, with the exception that also the test method is executed on the client side (see more info about Arquillian and TestNG here: Arquillian / TestNG method invocation sequence

I got a feedback from the JUnit5 community on Stackoverflow ( on this and it seems that the best solution is to implement a completely new JUnit 5 engine, based on the new Jupiter engine, but tweaking it to avoid running test methods and only forward them to Arquillian. It makes sense to me as the arquillian engine wouldn’t in fact run the tests but would forward them into a container which would then run the tests using the standard JUnit5 engine.

Hey Ondrej, I remember we had a discussion about JUnit 5 somewhere :slight_smile:

But apparently my memory failed me again. Thanks for detailed post and link to Stackoverflow, but most importantly for starting an effort to bringing JUnit5 execution to life!

I will go over it this weekend and come back to you.