Using JUnit5 in a Gradle project

Using JUnit5 in a Gradle project

To use JUnit5 in a Gradle project, I did the following in build.gradre and it worked.

Apparently, depending on the version of the junit-jupiter~ series and the version of the junit-platform-launcher, I cannot test JUnit5 well.

plugins {
  id 'java-library'
}

repositories {
  jcenter()
}

test {
  useJUnitPlatform {
    includeTags 'fast'
    excludeTags 'slow'
  }
}

dependencies {
  api 'org.apache.commons:commons-math3:3.6.1'
  implementation 'com.google.guava:guava:28.0-jre'

  testImplementation 'org.junit.jupiter:junit-jupiter-api:5.5.2'
  testImplementation 'org.junit.jupiter:junit-jupiter-params:5.5.2'
  testImplementation 'org.junit.platform:junit-platform-launcher:1.5.2'
  testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.5.2'
}
LibraryVersion
junit-jupiter-api5.5.2
junit-jupiter-params5.5.2
junit-jupiter-engine5.5.2
junit-platform-launcher1.5.2

コメント

タイトルとURLをコピーしました