O'Reilly logo

Mastering Software Testing with JUnit 5 by Boni García

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Jupiter tests with Gradle

Now, we are going to study the same example, but this time executed with Gradle. Therefore, we need to configure the build.gradle file. In this file, we need to define:

  • The dependency for the Jupiter API (junit-jupiter-api).
  • The dependency for the Test Engine (junit-jupiter-engine).
  • The plugin for the Test Launcher (junit-platform-gradle-plugin).

The complete source of build.gradle is as follows:

buildscript {   repositories {      mavenCentral()   }   dependencies {      classpath("org.junit.platform:junit-platform-gradle-plugin:${junitPlatformVersion}")   }}repositories {   mavenCentral()}apply plugin: 'java'apply plugin: 'eclipse'apply plugin: 'idea'apply plugin: 'org.junit.platform.gradle.plugin'compileTestJava { sourceCompatibility ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required