Is the 'IT.java' filename Suffix (instead of 'Test.java') for JUnit Integration Tests a convention? [closed]

雨燕双飞 提交于 2020-08-27 05:36:27

问题


I was used to naming my JUnit Integration tests with a *Test.java on the end eg DatabaseConnectionTest.java and placing them in their own integration test directory: eg test/integration/com...

On joining a new project I was directed

No, all the Tests go in the one directory, and we distinguish the Unit Tests from the Integration tests by pattern matching on the file name suffix.

So my file above would become DatabaseConnectionIT.java

Now I can see the logic in this. The test runner script can just pattern match for the files it is looking for, and all the tests are in the one location.

But I had never heard of the convention.

My question is: Is the 'IT.java' filename Suffix (instead of 'Test.java') for JUnit Integration Tests a convention?


回答1:


The IT.java suffix is a convention used by the Maven Failsafe Plugin. 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.)



来源:https://stackoverflow.com/questions/30077033/is-the-it-java-filename-suffix-instead-of-test-java-for-junit-integration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!