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?
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.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With