Difference between junit-vintage-engine and junit-jupiter-engine?

mockito-junit-jupiter
junit 5 parameterized test
junit-jupiter-params
junit 5 maven
mockito-junit 5
junit 5 gradle
junit 5 extensions
junit 5 vs junit 4

It's a two-fold question.

  1. What is the difference between junit-vintage-engine and junit-jupiter-engine?
  2. SpringBoot starter projects come with an exclusion for junit-vintage-engine. Is it to enforce the use of junit-jupiter-engine?

Below is the dependency of my SpringBoot project generated from Spring Initializr:

        <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>org.junit.vintage</groupId>
                <artifactId>junit-vintage-engine</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

junit-vintage-engine is used for running JUnit 4 tests; junit-jupiter-engine for JUnit 5 tests.

Presumably since you'll be writing only JUnit 5 tests for a new Spring Boot project, the vintage engine won't be needed, hence the default dependency exclusion in the POM.

Reference:

https://junit.org/junit5/docs/current/user-guide

JUnit 5 User Guide, What is difference between maven modules junit-jupiter-api and is enough? And do I need to add dependency on junit-vintage-engine ? You need both junit-jupiter-api and junit-jupiter-engine to write and run JUnit5 tests; You only need junit-vintage-engine if you are running with JUnit5 but your test cases still use JUnit4 constructs/annotations/rules etc


Difference between junit-jupiter-api and junit-jupiter-engine, Then, we'll use our Mockito extension in a JUnit 5 test class. Note that junit- jupiter-engine is the main JUnit 5 library, and For our test cases to be JUnit4 ( vintage) compatible, for IDEs that have no support for JUnit 5 yet,� junit-vintage-engine is the test engine for running JUnit 3 and JUnit 4 tests on the JUnit Platform. Because the JUnit Platform allows multiple test engines to run simultaneously, you can run your JUnit 3 and JUnit 4 tests side-by-side with tests written using JUnit Jupiter. I’ll show you how to do that later in the tutorial.


First question is also related with the version of JDK. To be able to use jupiter engine, you must have Java 8 or higher. For second question; since the vintage engine is for JUnit4 and JUnit4 is greater than 10 years old, it is not recommended to be used. As far as I know, it has not been updated along this time although java has been evolved so much. I think that is why spring initializers enforce the use of junit-jupiter-engine.

JUnit 5 Vintage and the JUnit Jupiter Extension Model – Build Smart , It also provides clear APIs for testers (Jupiter) and tools (Platform). JUnit Vintage: Implements an engine that allows to run tests written in JUnit 3 and 4 with JUnit 5 (2a.). JUnit 5's architecture is the result of that distinction. junit-vintage-engine. JUnit Vintage test engine implementation that allows to run vintage JUnit tests, i.e. tests written in the JUnit 3 or JUnit 4 style, on the new JUnit Platform. So You need both junit-jupiter-api and junit-jupiter-engine to write and run JUnit5 tests


Difference between junit-jupiter-api and junit-jupiter-engine, When including junit 5 tests in a project containing junit4 tests the natural path is to use junit 5 platform with the jupiter and vintage engines. Many organizations have a significant investment in JUnit 3 and 4, and thus cannot afford to convert wholesale to JUnit 5. Knowing this, the JUnit 5 team have provided the junit-vintage-engine and junit-jupiter-migration-support components to assist with migration.


Mockito and JUnit 5, Smart Resolution of Jupiter Engine and Vintage Engine for JUnit4. JUnit5 API artifact and your test sources become isolated from engine. junit-vintage-engine JUnit Vintage test engine implementation that allows to run vintage JUnit tests, i.e. tests written in the JUnit 3 or JUnit 4 style, on the new JUnit Platform. 2.1.4. Bill of Materials (BOM) The Bill of Materials POM provided under the following Maven coordinates can be used to ease


JUnit 5 Architecture or "What's Jupiter?", JUnit Vintage test engine implementation that allows to run vintage JUnit tests, i.e. tests written in the JUnit 3 or JUnit 4 style, on the new JUnit� JUnit Vintage Engine. Module "junit-vintage-engine" of JUnit 5. License: EPL 2.0: Tags: testing junit engine: Used By: 1,776 artifacts: Central (44) Version