When working on a project in Java, I like to name my integration and unit tests separately. Integration tests end ‘-IT’, and unit tests don’t.
This makes it really easy to run just unit or integration tests in IntelliJ by using one of these two patterns:
- Integration tests – ^(.*IT.*).*$
- Unit tests – ^(?!.*IT.*).*$
Make sure the Run configuration has the Test Kind set to Pattern, and searches for tests in the whole project.