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

1

9

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?

Niche answered 6/5, 2015 at 12:40 Comment(3)
In my opinion, it seems as much as a convention as INT for interface is.Nitwit
It's a convention where you're at, which is enough. It's not a universal convention, for example, I group types of tests by directory, so the file and class names don't have funky abbreviations.Assent
It's one of the default patterns recognized by the Maven Failsafe plugin, so it's hardly eyebrow-raising. ...what's your question, exactly?Kerguelen
E
21

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.)

Ebberta answered 6/5, 2015 at 14:51 Comment(1)
failsafe will also execute tests annotated with categories that are specified in the groups parameter maven.apache.org/surefire/maven-failsafe-plugin/examples/…Arachne

© 2022 - 2024 — McMap. All rights reserved.