What is difference between maven modules junit-jupiter-api
and junit-jupiter-engine
? Is it necessary to include both dependencies in build.gradle
?
Do I need to write both dependencies like
testCompile("org.junit.jupiter:junit-jupiter-engine:${junitVersion}")
testCompile("org.junit.jupiter:junit-jupiter-api:${junitVersion}")
or
testCompile("org.junit.jupiter:junit-jupiter-engine:${junitVersion}")
is enough?
And do I need to add dependency on junit-vintage-engine
?
From the docs:
junit-jupiter-api
JUnit Jupiter API for writing tests and extensions.
junit-jupiter-engine
JUnit Jupiter test engine implementation, only required at runtime.
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 ...
junit-jupiter-api
and junit-jupiter-engine
to write and run JUnit5 testsjunit-vintage-engine
if (a) you are running with JUnit5 and (b) your test cases use JUnit4 constructs/annotations/rules etcIn JUnit 5.4 this is simplified, see this answer for more details.