【问题标题】:Not test found with gradle and intellij only when press rerun failed tests仅当按下重新运行失败的测试时才使用 gradle 和 intellij 找到测试
【发布时间】:2021-05-10 01:34:54
【问题描述】:

当我运行测试并且测试失败并按下按钮 Rerun failed tests 时,我收到以下错误 Test events where not received No tests found for given includes,但很奇怪,因为测试刚刚运行并失败,当我尝试重新运行它时使用按钮重新运行测试不起作用。

我正在使用 gradle 6.8.1 intellij idea community edition 2020.3.2spring boot 2.4.2

这是我的build.gradle

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

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.mapstruct:mapstruct:1.4.2.Final'
    annotationProcessor 'org.mapstruct:mapstruct-processor:1.4.2.Final'
    compileOnly 'org.projectlombok:lombok'
    annotationProcessor 'org.projectlombok:lombok'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

test {
    useJUnitPlatform()
}

这是我的测试

package com.example.map.struc.example;

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import static org.junit.jupiter.api.Assertions.assertTrue;

@SpringBootTest
class MapStrucExampleApplicationTests {

    @Test
    void contextLoads() {
    }

    @Test
    void name() {
        assertTrue(false);
    }
}

【问题讨论】:

    标签: java spring-boot gradle intellij-idea junit


    【解决方案1】:

    使用 Gradle 运行测试时,Rerun Failed Tests 操作的已知问题:IDEA-194699

    【讨论】:

    • 他们说已经关闭,如果你有 junit5.3 它会工作,但我仍然有问题,我有 junit5.7
    猜你喜欢
    • 2018-07-26
    • 1970-01-01
    • 2021-07-13
    • 1970-01-01
    • 2023-04-04
    • 1970-01-01
    • 2020-05-30
    • 2018-12-03
    • 1970-01-01
    相关资源
    最近更新 更多