How to use JUnit 5 with Gradle?

前端 未结 6 1602
长发绾君心
长发绾君心 2020-12-02 14:16

I am trying to use JUnit 5 with Gradle after I succeeded in running a JUnit 4 test.

Expected result: Tthe JUnit 4 test gave a nice \'passed\' in the

6条回答
  •  春和景丽
    2020-12-02 14:42

    Checkout junit official documentation of how to use junit 5 with gradle.

    build.gradle

    plugins {
        id 'java'
    }
    
    repositories {
        mavenCentral()
    }
    
    dependencies {
        testImplementation('org.junit.jupiter:junit-jupiter:5.4.0')
    }
    
    test {
        useJUnitPlatform()
        testLogging {
            events "passed", "skipped", "failed"
        }
    }
    

提交回复
热议问题