When I tried to integrate ArchUnit into our setup, I noticed that ArchUnit tests were not being picked up by Gradle.
Our Gradle config contains several testing tasks to separate UnitTests, IntegrationTests, and AcceptanceTests. Those tasks only pick up tagged classes:
test {
useJUnitPlatform {
includeTags "UnitTest"
}
}
It appears that ArchUnit tests are not being picked up despite being tagged correctly.
@Tag("UnitTest")
@AnalyzeClasses(packages = "com.example", importOptions = {ImportOption.DoNotIncludeTests.class})
public class ArchTests {
...
}
When I invert the includeTags to excludeTags the ArchUnit tests are being picked up.
test {
useJUnitPlatform {
excludeTags "IntegrationsTest", "AcceptanceTest"
}
}
How can I configure Gradle/ArchUnit to preserve the include notion?
Does this message from ArchUnit issue 1238 help?
@Tagis actually from the JUnit Jupiter API, while ArchUnit is a completely different JUnit 5 engine that just builds on the JUnit platform. As such ArchUnit will never react to things that come fromorg.junit.jupiter. However, ArchUnit offers almost the same API, you just have to use@ArchTaginstead of@Tag. It should behave very similar to@Tagin all respects.