In September 2021, Geode added support for writing and running tests using JUnit 5: https://junit.org/junit5/docs/current/user-guide/
Most Geode modules already support JUnit 5. For most Geode modules, you can now write each test class using either JUnit 5's "Jupiter" API or the legacy JUnit 4 API.
Which modules support JUnit 5? Any source set that depends on geode-junit
or geode-dunit
already has JUnit 5 support. For those source sets you can start writing tests using the JUnit Jupiter API now, and Gradle will run them.
To add JUnit 5 support to a module or source set: Add lines like these to the "dependencies" configuration of your build.gradle
file:
testImplementation('org.junit.jupiter:junit-jupiter-api')
testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine')
The first line allows you to write unit tests using the JUnit Jupiter API. The second line allows Gradle to run your JUnit Jupiter unit tests.
To use JUnit Jupiter to write and run other kinds of tests (e.g. integrationTest
or distributedTest
), add similar lines to configure the appropriate source sets.