springBoot项目中使用junit测试出现java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=tes

springBoot项目中使用junit测试出现java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=testSave]出现的问题

1、问题描述

springBoot项目中使用junit测试出现java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=tes

2、经过查阅博客之后,发现网上的问题一般都是这三种。

  1. 忘记写@Test。
  2. 不是 public,参数,返回值,修饰符的错误。
  3. spring 包与 junit 的包的不兼容(由于是springBoot项目直接忽略这一点)

3、问题解决

  • ​ 最后是修改了测试类的路径名。也就是说在测试目录(sre/test/java)下的路径和src/main/java下的路径相同

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-375372h7-1585647917096)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20200331174347947.png)]

问题解决