I’d like to propose to change our test naming convention for the All IT test which runs all the IT tests of a module. Right now we use AllITs. I’d like to propose that we move to AllIT.
The main reason is that there’s a SonarQube rule that uses ^((Test|IT)[a-zA-Z0-9_]+|[A-Z][a-zA-Z0-9_]*(Test|Tests|TestCase|IT|ITCase))$ as the default and I’d rather we comply than have to customize the rule.
Yes, it means that when contrib extensions upgrade their parent pom to XWiki 15.4, they’ll also need to rename AllITs to AllIT. I don’t see that as a big problem and we have very few contrib extensions having integration tests.
Extension authors will need to be careful though since if they don’t rename AllITs, the failsafe plugin will not execute AllITs anymore after the parent upgrade and they might not realize it.
What we really need is a build check that fails the build if there are some test classes (ie classes with @Test annotation that are not executed by surefire or failsafe).
ok, one simple way to fix just the contrib extension issue would be to use Maven Failsafe Plugin – failsafe:verify , i.e. update the contrib extensions having IT tests with it.
And it’s not that easy to reconcile org.xwiki.whatsnew.test.ui.WhatsNewIT with org.xwiki.whatsnew.test.ui.AllITs$NestedWhatsNewIT. For that the check will need to parse AllIT and know the concept of nested tests (i.e parse @Nested) to extract out NestedWhatsNewIT from:
@Nested
@DisplayName("What's New UI")
class NestedWhatsNewIT extends WhatsNewIT
{
}
Actually, a better way is maybe to have a globally registered JUnit5 extension that records executed tests and outputs its own format (understanding nested tests) so that it can more easily be compared to test classes in a check later on.