Why were JUnit Jupiter and JUnit Vintage separated

2020-08-10 08:00发布

问题:

I saw that JUnit5 is released, and i applied in IntelliJ V2016.2.1 and run some testcase.

so saw below screenshot.

i have just two questions.

  1. Why were JUnit Jupiter and JUnit Vintage separated When I Running TestCase in IntelliJ?

  2. Can i Merge JUnit 4 and 5 TestResults?

回答1:

JUnit 5 is more than just a new API (called JUnit Jupiter). It also contains an abstraction layer for tools to run JUnit tests (called JUnit Platform). The platform has no knowledge of either JUnit 4 or Jupiter or anything else really. All it knows are test engines, which will execute the tests they were written for.

(You can read more about this in the user guide or a post I wrote about JUnit 5's architecture.)

  1. Why were JUnit Jupiter and JUnit Vintage seperated When I Running TestCase in IntelliJ?

What you see is the launcher executing two engines, the one for the new API (Jupiter) and the one for JUnit 4 (Vintage). Each engine represents the tests it ran in its own data structure, which IntelliJ shows as the trees you see.

  1. Can i Merge JUnit 4 and 5 TestResults?

This would have to be an IDE feature, that - as far as I know - is not implemented.