-
Notifications
You must be signed in to change notification settings - Fork 195
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 integration spike #137
Comments
Based on my very short investigation, we will probably need to create our own TestEngine. The PoC you have referenced is using an approach of the extensions (callbacks) when you don't have the context of the whole test suite. If I understand it correctly, this is something similar to the current |
Thanks for checking it out. What are the next steps then? |
Definitely, spend more time with the JUnit 5 extensions - if there is some way of getting the whole test-suite context - eg. from the storage that is provided by JUnit. If not, then start moving the old runner logic to a new
|
Looks like as per Matous's above comment we don't have suite context if we decided to go through junit 5 extension. junit-team/junit5#1145. Now if we decided to go with implementing custom TestEngine for Arquillian. We will be having lot of duplications from junit-jupiter-engine due to final & private variable. Also I found this interesting comment - junit-team/junit5#20 (comment) about discovering all tests twice if you tries to use jupiter-engine as composition in your engine to avoid duplications Now digging into test extension, to see any other possible ways. |
So, I've tried to create the integration using a combination of a new During the implementation I found a few obstacles: So, we need to listen on the very beginning and then delegate the test execution to the standard Technically speaking, that could be managed by overriding some Jupiter's internal classes and using delegation. It isn't easy to do, it would require several hacks, code duplications, and reflections, but is probably doable. The last obstacle is that we need the Summing it up. We can provide Arquillian functionality in the context of JUnit 5 extension, but not for the context of the whole test suite execution. |
As the Arquilian engine for JUnit 5 is not feasible for now, I've been trying to create an extension that would do similar work as JUnit 4 Arquillian Rules do. JUnit 5 versions Code Dependencies: Extension class Implementation Container |
I've tried the approach of creating a JUnit5 extensions almost a year ago when I started this discussion (I'm the Payara folk mentioned above). I came to a similar conclusion as @MatousJobanek - it's not possible to intercept test execution so that it's routed to the test executed in the container. The only thing I could do is to run the test in the Arquillian container before it was executed by Junit5 outside the container. But I couldn't prevent JUnit5 running the tests outside the container just with a JUnit5 extension. Therefore my conclusion is the same - we either need to build a JUnit5 test runner, possibly duplicating lots of code from the Jupiter engine, or wait until JUnit5 implements junit-team/junit5#1145 (which may take too long according to the comments) My source code is here: OndrejM/arquillian-junit5-hacks, with the extendion class ArquillianExt.java. I didn't get as far as @MatousJobanek and the code is much simpler, but it demonstrates the same problem when you try running the BasicJunit5ArquillianTest - the test runs succesfully in the container but then it fails when running out of container because a managed resource isn't available (the test uses embedded Payara Server so it runs out of the box without external container running). |
Hi @OndrejM, |
@OndrejM @MatousJobanek Has there been any progress or is Arquillian still not working properly with JUnit5? |
@keilw if you follow this thread and linked issues you will see that we are missing few pieces on JUnit 5 side to make this integration happen. |
@bartoszmajsak Thanks for the update. I tried to add the "Vintage" module which looks like it works fine for now. If JUnit 5 can solve this, we would be happy to use those new versions without the "Vintage Look" ;-) |
@keilw we would love to make it happen. hopefully we can follow up on that any time soon. Another approach could be to use JUnit rules instead of runner we have introduced late last year http://arquillian.org/blog/2017/12/20/arquillian-core-1-2-0-Final/ |
I had have a look at I Would be very happy about this feature. Any guesses when it would be possible to use JU5 with arquillian? |
Arquillian's implicit behavior of running tests on remote container and then silently tunneling them to client JUnit was always hard to understand for developers. Maybe it is good opportunity to switch testing to more explicit solution. I'm thinking of something like that: @Test
void assertAtContainer(Arquillian arq) {
// when
int result = arg.runAtContainer(new ArquillianExecution<Integer>() {
@Inject
@Transactional
Integer execute(MyDao dao) {
return dao.countActiveUsers();
}
});
// then
assertThat(result).isGreatherThen(0);
} |
@bartoszmajsak this would be also really great to have support. |
@bartoszmajsak, has there been any additional push for this? I'd love to be able to use JUnit-5 with Arquillian. What's the current status of this? |
@james-r-smith nothing besides the PoC @MatousJobanek worked on back in the day. Two crucial feature requests in JUnit 5 are still not implemented:
You would probably be fine with |
@bartoszmajsak You might have noticed that junit-team/junit5#157 has been implemented... 😄 |
@bartoszmajsak Hi! Any idea if junit5 will be supported in near future? |
Is there anyone working on this feature? It would be really cool to adopt JUnit 5 in Arquillian projects |
@gastaldi no one that I'm aware of. It's up for grabs. |
Since Junit Jupiter 5.5.x has released intercepting test methods are available. I made an extension based on that. |
Nice! It would be great if it could make it into arquillian directly. |
During his testing @manusa found out that integration tests are not getting executed during their run on CircleCI. The reason was due to incompatibility of Junit 5 with Arquillian. I've reverted to Junit 4 in kubernetes-itests/ module for now. We can update this whenever this gets resolved: arquillian/arquillian-core#137
During his testing @manusa found out that integration tests are not getting executed during their run on CircleCI. The reason was due to incompatibility of Junit 5 with Arquillian. I've reverted to Junit 4 in kubernetes-itests/ module for now. We can update this whenever this gets resolved: arquillian/arquillian-core#137
Hi, just wondering. Any progress here? |
I'm pretty sure the current solution is stable enough to become part of the Arquillian project. I'm not an Arquillian committer but I can submit this to the Arquillian project if nobody plans to do so. Another option would be to submit this as a separate project to the Eclipse foundation as an Arquillian extension. I've rewritten the Jakarta Batch TCK to use Arquillian and JUnit 5, I wrote about it here: https://ondro.inginea.eu/index.php/possible-ways-to-use-arquillian-in-jakarta-ee-tcks/. I had no problems running the rewritten test suite against Payara Server with all tests passed. Therefore I believe that the current solution is stable enough. It would be good if some other people reported their success stories with this solution or tried to rewrite their current Arquillian tests to JUnit 5 and report how it went. |
I would second that opinion. Something needs to be done with JUnit 5 and since there is no other solution, this would be a great addition |
Hey @OndroMih, thanks for sharing your experience with JUnit 5 and Arquillian. I'm all for moving this forward so apologies there was not much traction on this issue - I have other things which are consuming both my professional and personal time. That said I'm really happy to see people in the community involved and interested. I believe that should be part of |
@bartoszmajsak There are still unmerged my two pull requests, but generally it works well. |
Hope this can be moved forward. As I manage several projects that use junit and arquillian intensively, I'll try to test out something soon on these projects to see where we stand. |
Hi @bartoszmajsak, I'm pretty sure it's safe to start by porting @zforgo 's work. Then @dmatej can raise his pull requests against the ported code in arquillian-core to fix some known issues. |
I integrated @zforgo work as a module in arquillian-core. Again thanks for this milestone! You can find all the adjustments on the The original code has no tests, so I don't feel comfortable with merging it yet. There are, however, some external integration tests which seems to be working fine with a few tweaks. Any contributions here would be more than awesome, but I will try to find some time this week to do a bit of test-after-development :) |
@OndroMih @arjantijms do you have any larger projects you could give it a spin? If needed I can push snapshot artifact so that it's easier for you to consume. |
I've got a try using the javaee-samples/jakartaee8-tck project and it seems to be working fine. |
Thanks for your feedback @Thihup! |
Definitely please put out a snapshot |
I can't get it to work...
Any ideas? |
More context:
|
I think it's a bug, when I check |
The preceding PR #285 fixes the issue and gets my tests to pass |
@bartoszmajsak Please check & merge |
Not sure if the snapshot is available, but I have put the latest branch version up on Payara's Nexus: Arquillian artifacts:
Payara connector artifacts (example):
Payara artifacts can be browsed here: Sample project can be found here: https://github.com/flowlogix/flowlogix/tree/master/jakarta-ee/jee-examples |
Thanks @lprimak. I'm actually about to cut the next alpha release today with all the changes (including yours) :) |
Thank you all for your help! Much appreciated! |
Issue Overview
JUnit 5 Final has been around for a while and we see more demand to bring integration with Arquillian for the community.
Goal of this spike is to explore what needs to be implemented and plan following tasks based on this.
There has been a discussion on the forum and a PoC started by Payara folks.
The text was updated successfully, but these errors were encountered: