Idea running JUnit5 tests twice
Answered
My IDE is executing my unit tests twice.
The first test that appears in the Run - test left-hand window pane is the full package and class name, the second test is just the class name.

Any ideas?
Please sign in to leave a comment.
Please provide a screenshot with your run/debug configuration for this test.
Junit 5 runs the test with help of test engines, and when 2 engines can run the test, then the test would be run twice. Could this be an answer?
Anna
I have 2 dependencies in my maven pom:
The first is the normal JUnit5 which contains the annotations like @Test, @BeforeEach etc.
The second is provides support for legacy JUnit4 tests, and the test in question inherits from the maven-plugin-test-harness which pre-dates JUnit5
Not sure if the maven-plugin-test-harness is the reason, but if I don't include the dependency on junit-vintage-engine then Intellij tells me there are no tests to run.
Please try the latest IDEA EAP (https://www.jetbrains.com/idea/nextversion/). And when it doesn't help, please attach a sample project to reproduce. Thanks
OK, once my testing builds up and it becomes more painful, I'll try out the EAP.
Still executing vintage tests twice in 2017.2.1
Looks like it's caused by the use of a JUnit4 AbstractTestCase from a third-party library that I can't do without, so it points the finger at the JUnit5 junit-vintage-engine.
When I get a chance I'll strip down a project to make a bug project for you.
If you extend junit 3 test case then vintage engine would recognise it as junit 3, if you have junit 5 annotations in your class - jupiter engine would recognise it as junit 5. And both engines would try to run the test. But vintage engine would run only tests starting with "test" and jupiter only annotated ones - so it would be 2 items in the tree but effectively test methods would be run only once (static initialisers would be run twice though).
Hope this helps.
Thanks,
Anna
That's what I figured.
I don't see the issue when running the tests under maven.
Since the tests are relatively short, I will just ignore the issue rather than trying to work around it or dropping back to JUnit4.