0

I've got working junit test cases I'd like to run in an Eclipse test suite. However, Eclipse only seems to have test suite support for JUnit 4 and 3.

It seems my options are to either either downgrade my test cases (which I'm unsure how to do) or upgrade the test suites as well (which I can't seem to find an option for).

Any help?

EDIT: For clarity, I'm working on the latest Eclipse Photon version, just downloaded it two days ago.

Ben Dere
  • 1
  • 2
  • The current Eclipse Photon (4.8) ships with JUnit5 support, see https://wiki.eclipse.org/JDT_UI/JUnit_5#Eclipse_build_with_JUnit_5.0.0_GA_support: and https://www.eclipse.org/community/eclipse_newsletter/2017/october/article5.php. Please include the Eclipse version you are on in the question. – wwerner Jul 18 '18 at 18:53
  • @wwerner , I'm using exactly that version of Eclipse, sorry for the lack of clarity. – Ben Dere Jul 20 '18 at 13:08

2 Answers2

2

With a plain Photon (Java Developers flavour) install, follow these steps to get a working simple eclipse project with a JUnit5 test and a suite containing this test.

  • On project creation or in the project properties, add JUnit5 as library Add JUnit library Select JUnit5
  • Add your tests, run them Test & Test run
  • Add a test suite (the new Test Suite wizard is lacking the option to create a JUnit5 Suite, you'd need to write it by hand - was that what you were asking?) Suite & Suite run
wwerner
  • 4,227
  • 1
  • 21
  • 39
1

In package explorer, do right click on a project and,

  • Click 'Build Path'
  • Click 'Add Libraries'
  • Click on 'JUnit 5' in the list and next, finish.

Then run the tests again.

ozinal
  • 29
  • 3