测试test程序报错Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 3.848 s <<< FAILURE! - in

目录

  • 报错信息
  • 1.增加POM坐标
  • 2.测试代码输出

在这里插入图片描述

报错信息

Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 3.848 s <<< FAILURE! - in com.example.demo.RxtxTest SerialDemo Time elapsed: 0.161 s <<< ERROR!

1.增加POM坐标

  <build>
        <plugins>
                <!--项目打包用的插件-->
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <fork>true</fork>
                </configuration>
            </plugin>
            <!--测试时不进行编译-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.2</version>
                <configuration>
                    <skipTests>true</skipTests> <!-- 不会编译测试 -->
                </configuration>
            </plugin>
        </plugins>
    </build>

2.测试代码输出

@RunWith(SpringRunner.class)
@SpringBootTest
@Slf4j
public class RxtxTest {
    @Test
    public void souresut(){
        System.out.println("测试输出");
    }
}

你可能感兴趣的:(Java,test,spring)