How to use JUnit 5 with Gradle?

前端 未结 6 1614
长发绾君心
长发绾君心 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:48

    just adding to the knowledge base, i just got the following to work with gradle 4.7:

    apply plugin: 'java'
    repositories {
        jcenter()
    }
    
    dependencies {
        testImplementation 'org.junit.jupiter:junit-jupiter-api:5.1.1'
        testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.1.1'
    }
    
    test {
        useJUnitPlatform()
    }
    

提交回复
热议问题