Community
Participate
Working Groups
JUnit team has released first alpha of new JUnit 5 testing framework. JUnit 5 is complete rewrite of the popular5 testing framework and among other goals of the new version is better support for IDEs and other third party test runners. They are currently gathering feedback from potential consumers of JUnit api, so I would thing that this is a very good time for Eclipse JDT team to take a hard look at JUnit 5 development and start working together with Junit team on better test runner api design.
The first stable release of JUnit 5 is out... IntelliJ already provides support for it... Time to catch up!
Noopur, please have a look at http://junit.org/junit5/ and see how we can integrate support for JUnit 5 in Eclipse. JUnit 5 requires Java 8. Although the JUnit Vintage sub-project should allow running JUnit 3 and 4 tests, we still need to keep the native JUnit 3 and 4 runners to support running tests in environments where Java 8 is not available. https://dev.eclipse.org/mhonarc/lists/jdt-ui-dev/msg01488.html mentioned a prototype for basic JUnit 5 support in Eclipse, but it doesn't look like it has been updated recently, so I guess it's probably easier to just start from scratch.
http://search.maven.org/#search%7Cga%7C1%7Corg.junit and page 2 should yield links to download pre-built versions of JUnit 5 JARs and source JARs. These will eventually go into Orbit, but only after they have been officially released. Use the newer org.junit.platform, org.junit.vintage, and org.junit.jupiter versions (M2), and not the 5.0.0-ALPHA stuff. Implementation-wise, the new org.eclipse.jdt.junit5.runtime bundle that will be provided as part of this bug will depend on the orbitized JUnit 5 bundles. In non-OSGi contexts where the o.e.j.junit5.runtime JAR will just be put on the classpath, the OSGi dependencies in the MANIFEST.MF will not be processed anyway.
Released the initial code to BETA_JUNIT5 branch of jdt.ui repo and added the new org.eclipse.jdt.junit5.runtime bundle with required JUnit 5 JARs to a new repo on GitHub. Follow these steps to setup the code and try out the JUnit 5 support: - Open a new workspace with Eclipse 4.7 M3 build and set API baseline as Eclipse 4.6. - Clone the repo: https://github.com/noopur2507/eclipse-junit5.git and import the project: org.eclipse.jdt.junit5.runtime - Copy the jars from the cloned folder eclipse-junit5\JUnit-5-JARs to your Eclipse's "dropins" folder. - Clone the repo: git://git.eclipse.org/gitroot/jdt/eclipse.jdt.ui.git and checkout the BETA_JUNIT5 branch. Import the projects: org.eclipse.jdt.ui, org.eclipse.jdt.junit, org.eclipse.jdt.junit.core, org.eclipse.jdt.junit.runtime, org.eclipse.jdt.junit4.runtime - Restart Eclipse. The workspace should not have any error now. - Launch a runtime Eclipse application to try out the JUnit 5 support. You can add the JUnit 5 library container to a project via the Java Build Path settings or with the help of a quick fix on @Test / @TestFactory / @Testable. It's a work in progress and known to have some missing functionality and issues, which are not yet listed on Bugzilla. So, please feel free to provide feedback and report issues.
First and foremost, thanks for the great work Noopur!!! I tried it out and am really quite impressed. :) The only issue I noticed is that the green/red success/failure bar in the JUnit view is displayed as green if the return type for a dynamic test method is invalid. The dynamic test and its enclosing class are in fact marked as as failures (i.e., red). Thus, the overall test run should also be marked as a failure. To reproduce this, just run the DynamicTestsDemo [0]. If you need me to create a new bug issue to track this, just let me know. Cheers, Sam [0] https://github.com/junit-team/junit5/blob/ba94add9b2c522f867f17a693960fad6b72716ca/documentation/src/test/java/example/DynamicTestsDemo.java
(In reply to Sam Brannen from comment #5) Thanks, Sam. I have created bug 507171 for the reported issue.
Just a note to notify about the 5.0.0-M3 release http://junit.org/junit5/docs/current/user-guide/#release-notes-5.0.0-m3 there are several breaking changes mentioned, I have no idea if Eclipse is hit by one of them but will worth planning to test it.
I have updated the repositories mentioned in comment #4 to adapt to the 5.0.0-M3 release of JUnit 5. Instead of Eclipse 4.7 M3 build, the 4.7 M4 build should be used now to try out the JUnit 5 support in Eclipse based on the steps in comment #4.
I am a newbie and I cannot run any single JUnit5 test following the steps described here :( I always get a NullPointerException. What do I do wrong? P.S. I use Windows. I see JUnit 5 test runner assigned to my project in the Eclipse. P.S.S. Btw, is there a way to start an Eclipse with JUnit5 support not from another Eclipse, but like a separate Application? Like compiling and deploying org.eclipse.jdt.junit.runtime somewhere? Sorry if it is a stupid question... !STACK 0 java.lang.NullPointerException at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate$ClasspathLocalizer.localURL(JUnitLaunchConfigurationDelegate.java:502) at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate$ClasspathLocalizer.entryString(JUnitLaunchConfigurationDelegate.java:484) at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate$ClasspathLocalizer.addEntry(JUnitLaunchConfigurationDelegate.java:476) at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate$ClasspathLocalizer.localizeClasspath(JUnitLaunchConfigurationDelegate.java:467) at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.getClasspath(JUnitLaunchConfigurationDelegate.java:444) at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.launch(JUnitLaunchConfigurationDelegate.java:161) at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:885) at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:739) at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1039) at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1256) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
Created attachment 266815 [details] Installing Eclipse plug-ins into host (In reply to Dmytro Shyshchenko from comment #9) > I am a newbie and I cannot run any single JUnit5 test following the steps > described here :( I always get a NullPointerException. What do I do wrong? > P.S. I use Windows. I see JUnit 5 test runner assigned to my project in the > Eclipse. Your stack trace shows that it is not able to find the "org.eclipse.jdt.junit5.runtime" bundle which is present in the GitHub repo: https://github.com/noopur2507/eclipse-junit5.git. See comment #4 - make sure that you have cloned and imported the "org.eclipse.jdt.junit5.runtime" project in your Eclipse workspace. I would recommend to use the latest stable Eclipse I-Build (currently, I20170212-2000) which is available at http://download.eclipse.org/eclipse/downloads/index.html and follow the steps from comment #4. > P.S.S. Btw, is there a way to start an Eclipse with JUnit5 support not from > another Eclipse, but like a separate Application? Like compiling and > deploying org.eclipse.jdt.junit.runtime somewhere? Sorry if it is a stupid > question... After this step from comment #4: > - Restart Eclipse. The workspace should not have any error now. you would have imported all the required projects in your Eclipse workspace with no errors and the JUnit jars would be present in your Eclipse's "dropins" folder. Now, you can go to File > Export... > Deployable plug-ins and fragments. Here, select all the imported plug-ins and choose "Install into host..." under "Destination". Click Finish. It will install these plug-ins into your Eclipse IDE. (See attached screenshot) As a result, you now have an Eclipse IDE with JUnit 5 support in it. You can open a new workspace with it and try out the JUnit 5 support directly.
This feature will not be part of Oxygen (4.7) since the GA of JUnit 5 is now in 3Q 2017: https://github.com/junit-team/junit5/wiki/Roadmap
FYI: The JUnit 5 team is reconsidering the road map for a GA release. Thus, could you please inform us of the official cut-off date by which JUnit 5 GA would need to be released in order to have support included in Eclipse 4.7? Thanks! The JUnit Team
For Eclipse 4.7, milestone M7 (2017/05/12) is the feature freeze. So we will need a feature complete version of JUnit 5 for M7. It would be better to have a JUnit 5 preview before M7 so that we can adopt the changes and do an initial CQ review and Orbit contribution. We could also target the potential Java 9 release on July 27. Then, we could ship the JUnit 5 support in the same way as Java 9 support. Eclipse Planning Council is yet to take a decision on how it will be shipped. We can also ship the JUnit 5 support with Oxygen.1 (4.7.1) in September 2017. Or, based on the current GA plan of JUnit 5, the support can be included in Oxygen.2 (4.7.2) in December 2017.
Hi Noopur, Thanks for the super fast feedback. Based on the dates you've listed, the JUnit 5 Team will tentatively aim to have a GA release available to be included in Oxygen.1. Really looking forward to that! Cheers, Sam
(In reply to Sam Brannen from comment #14) > Hi Noopur, > > Thanks for the super fast feedback. > > Based on the dates you've listed, the JUnit 5 Team will tentatively aim to > have a GA release available to be included in Oxygen.1. This looks like a good choice to me.
The steps to setup beta JUnit 5 support in Eclipse have been added to https://wiki.eclipse.org/JDT_UI/JUnit_5.
What does the "BETA JUnit 5" target milestone mean? Will it make it into 4.7.1 if the JUnit team releases according to plan?
(In reply to Marc Philipp from comment #17) > What does the "BETA JUnit 5" target milestone mean? Will it make it into > 4.7.1 if the JUnit team releases according to plan? Eclipse Planning Council is currently deciding the schedule for upcoming Oxygen releases to include JUnit 5 and Java 9 support. The current proposal is to first have a Marketplace support after JUnit 5 GA in August/September. Then, release Oxygen.1 on September 27 without Java 9 and JUnit 5 support. And later release Oxygen.1a on October 11 with Java 9 and JUnit 5 support. Refer https://dev.eclipse.org/mhonarc/lists/eclipse.org-planning-council/msg02780.html for the discussion.
So it got pushed back? Because of Java 9 or JUnit 5? Is Oxygen.1a a real release or an "alpha" release?
(In reply to Marc Philipp from comment #19) > So it got pushed back? Because of Java 9 or JUnit 5? Is Oxygen.1a a real > release or an "alpha" release? Oxygen.1 was always scheduled for September 27. Oxygen.1a with Java 9 + JUnit 5 support is now scheduled for October 11 to allow Oxygen.1 to be a usual stable release. Oxygen.1a will be a real release on top of Oxygen.1 and will be included in updates to all users. Marc, could you please comment on the scheduled date for JUnit 5 GA so that we can plan the Eclipse Marketplace support around the same time?
GA is scheduled for August 24, 2017 (see https://github.com/junit-team/junit5/milestone/10). Originally it was later, but we moved it from September to August to be in time for the Oxygen.1 release. If you now don't need it until a bit later, we might do an RC3 on that date and release GA in early September (if that's still in time for Oxygen.1a). So, when do you need the GA release?
Having RC3 around August 24 and GA in the first week of September will be good for Oxygen.1a.
New Plan: RC3 on Aug 24 GA on Sep 6 Does that work for you?
(In reply to Marc Philipp from comment #23) > New Plan: > RC3 on Aug 24 > GA on Sep 6 > > Does that work for you? Yes, thanks!
(In reply to Noopur Gupta from comment #16) > The steps to setup beta JUnit 5 support in Eclipse have been added to > https://wiki.eclipse.org/JDT_UI/JUnit_5. We now have a U-build and update site available for JUnit 5 support in Eclipse. The wiki page has been updated with details.
(In reply to Noopur Gupta from comment #25) > (In reply to Noopur Gupta from comment #16) > > The steps to setup beta JUnit 5 support in Eclipse have been added to > > https://wiki.eclipse.org/JDT_UI/JUnit_5. > > We now have a U-build and update site available for JUnit 5 support in > Eclipse. The wiki page has been updated with details. JUnit 5 support is now included in Eclipse Photon (4.8) builds also. You can try it out with the latest Integration build available here: http://download.eclipse.org/eclipse/downloads/index.html. The wiki page (https://wiki.eclipse.org/JDT_UI/JUnit_5) has been updated. Check out the Eclipse Marketplace entry for details on JUnit 5 support in Eclipse: https://marketplace.eclipse.org/content/junit-5-support-beta-oxygen.
Would pushing back the JUnit 5.0 GA release to this weekend still be acceptable?
(In reply to Marc Philipp from comment #27) > Would pushing back the JUnit 5.0 GA release to this weekend still be > acceptable? Yes, that would be fine.
Marking this bug as resolved. You can have a look at the noteworthy items here: https://www.eclipse.org/eclipse/news/4.7.1a/#junit-5-support. Thanks to everyone who was involved!
Congratulations on a job well done!