IntelliJ无法发现junit测试

时间:2019-10-12 15:24:35

标签: intellij-idea junit junit-jupiter

您好,我已经在互联网上搜索了几个小时,并且多次发现此问题,但是这些答案都没有帮助我。我试图在春季启动应用程序中运行Junit5 jupiter测试,但是我收到此错误:

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':test'.
> No tests found for given includes: [com.danielazheleva.blog.services.Impl.TripServiceImplTest](filter.includeTestsMatching)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s

我正在使用 IntelliJ 2019.2.3 摇篮5.2.6 Groovy 2.5.8

这是我的build.gradle文件

plugins {
    id 'org.springframework.boot' version '2.1.7.RELEASE'
    id 'io.spring.dependency-management' version '1.0.8.RELEASE'
    id 'java'
}

group = 'com.danielazheleva'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '8'

repositories {
    mavenCentral()
}

dependencies {
    compileOnly 'org.projectlombok:lombok:1.18.8'
    compile 'org.springframework.boot:spring-boot-starter-data-elasticsearch:2.1.8.RELEASE'
    compile 'com.h2database:h2:1.4.199'
    compile 'org.modelmapper:modelmapper:2.3.5'

    annotationProcessor 'org.projectlombok:lombok:1.18.8'

    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-web'

    runtimeOnly 'mysql:mysql-connector-java'

    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testCompile 'org.mockito:mockito-core:2.1.0'
    testImplementation('org.junit.jupiter:junit-jupiter:5.5.2')

}

test {
    useJUnitPlatform()
}

我要运行的测试:

package com.danielazheleva.blog.services.Impl

import org.junit.jupiter.api.Test


class TripServiceImplTest {


    void setUp() {
        super.setUp()
    }

    @Test
    void testGetAllTrips() {

    }
}

0 个答案:

没有答案
相关问题