Spring boot Spring引导单元测试未运行

Spring boot Spring引导单元测试未运行,spring-boot,junit,Spring Boot,Junit,我已经尝试了很多方法来解决这个问题。但是运气不好,我的测试用例没有运行 当我编写mvn clean包时,它运行的是单个测试用例。 服务层测试 实际上,问题在于pom文件 在获取错误时创建Maven文件 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactI

我已经尝试了很多方法来解决这个问题。但是运气不好,我的测试用例没有运行

当我编写mvn clean包时,它运行的是单个测试用例。

服务层测试


实际上,问题在于pom文件

在获取错误时创建Maven文件

<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>org.junit.vintage</groupId>
                <artifactId>junit-vintage-engine</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <!-- https://mvnrepository.com/artifact/junit/junit -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
    </dependency>

org.springframework.boot
弹簧起动试验
测试
org.junit.vintage
朱尼特老式发动机
朱尼特
朱尼特
4.12
测试
我所做的是删除了排除和Junit附加依赖项

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

org.springframework.boot
弹簧起动试验
测试

您能提供测试代码吗?也许你错过了一些annotations@MarcusHeld当然我会的。我不能添加整个代码,所以添加的服务层单元测试对我来说很好。
mvn测试是否产生相同的结果?测试是否在IDE中运行?@MarcusHeld yes,
mvn test
产生相同的结果。当我在IDE中运行每个测试时,一切正常。
<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>