-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ArchUnit is run regardless of selected tests scope with JUnit5 in IntelliJ IDEA #546
Comments
I'm not an expert on JUnit internals (at all 😉), but I wonder whether this could be related to #504? |
Hmm, my problem is, that I can't really reproduce this 🤔 Could you share a little example project that reproduces the problem? Or can you reproduce your problem in ArchUnit-Examples? Thanks! |
Sorry for the late answer, I'll put together an example project tomorrow. |
I have stripped down the project I work on and in that process I've managed to find some interesting things:
Here's the stripped-down project: https://github.com/esiha/archunit-bug-546 |
I've run into this same issue on several different projects with 0.23.1 (they're all Java). Any update on a fix or a better workaround? I've had to resort to temporarily removing ArchUnit from the classpath while I'm doing my fast TDD test cycling. |
I also have this problem : when I filter tests on a directory or some tags, ArchUnit is processing all the classes even if the tests are not run :-( |
I looked into this issue again, and I think I understand where the problem/confusion comes from. I never could reproduce it, because I was looking for ArchUnit resolving the classes of To conclude, I don't think that the If possible I would like to keep the implementation as it is, since it is robust and doesn't require further dependencies. However, I think there is a massive possible performance boost by turning of the transitive resolution process for further dependencies for this specific internal class scanning. This way during the discovery process ArchUnit would really only import the classes within the package, which should be fast, and refrain from importing all sorts of JDK and library classes. I published a SNAPSHOT where I implemented this, could you try if this is fast enough for your usual test flow? This will still use ArchUnit to scan the classes within the given package to test, but should optimize the importer.
In the end each |
I've tested your snapshot with the sample repository I've mentioned earlier. I confirm the scan is still present but much faster as it is now constrained only to the classes present in the project. To me, it's an acceptable workaround I'd be happy to use on a daily basis. |
Cool, then I'm gonna create a PR an merge it 👍 |
-> #881 |
Some context to help understand
I have a Kotlin project with the following package structure:
And some ArchUnit tests that ensure that the hexagonal architecture constraints are met in
com.example.project.HexagonalArchitectureTest.kt
.I'm using:
The problem I'm facing
Whenever I run a subset of my tests in IntelliJ IDEA, say by hitting Ctrl+Shift+F10 on the
domain
package, the test console shows a bunch of ArchUnit-related logs before actually running the tests I've selected, starting with:This is a problem to me because this situation artificially increases the duration of my feedback loop when working in a Test-Driven Development setting: the ArchUnit analysis is usually much longer to run than the tests I actually meant to run.
What I've been able to work out so far regarding this issue
@ArchTest
s has no effect on the issue;packages
attribute of@AnalyzeClasses
has no effect on the issue;archunit-junit4
instead ofarchunit-junit5
works as a workaround;The text was updated successfully, but these errors were encountered: