开放自由和测试 Class 姓名

Open liberty and Test Class Name

测试 class/file 名称是否必须以 "IT" 结尾才能使 lilberty:dev maven 目标生效?当我按照 Creating a RESTful web service 并在 finish 文件夹中发出 "mvn liberty:dev" 命令时,一旦我将测试文件名 EndpointIT.java 更改为 EndpointTest 并且 class 名称 EndpointIT EndpointTest(仅此而已),按 ENTER 时我在控制台中看到了测试错误。

如果我将 file/class 名称更改为 EndpointTestIT(末尾带有 "IT"),测试将再次运行。

在我看来,一个文件和class必须有"IT"后缀。这是设计功能的要求吗?还是我错过了什么?

IT 后缀是 Maven 故障安全插件的约定,如 :

中所讨论

All classes in the test directory that have the suffix IT are executed by this plugin in the integragion-test phase. (Tests with suffix Test are exectued by the Maven Surefire Plugin in the test phase.)

可以在 Baeldung 教程中找到更多信息,Integration Testing with Maven