IDEA 报错:no tests were found

问题描述:在进行单元测试时,报 no tests were found

@RunWith(SpringRunner.class)
@SpringBootTest
public class ServerTest {
    @Test
    public void getData(){
        System.out.println("测试");
    }
}

解决方案:

发现是项目的 .idea.iml.idea.iml.idea.iml 文件,测试方法可以正常运行。

 

问题出现原因: 项目由其他项目改造,部分.iml文件未改

 

文档参考地址1: https://cloud.tencent.com/developer/article/1709756