-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Expand ArchUnit Testing #12099
Comments
Here might be a good candidate for ArchUnit, if we decide to take action on this comment: Forbidding mutable test fields. |
I would consider a test field immutable only if it's value never changes throughout the life of the test run, including the place where it got its value from. If I can get 2 different values from the same method call when executing it at the start of the test run and any time between then and the end of the test run, then the field isn't immutable. |
Using ArchUnit, we can only make sure that fields are @ArchTest
public static final ArchRule NEW_RULE = fields().that()
.areDeclaredInClassesThat()
.haveSimpleNameEndingWith("Test")
.should()
.beFinal(); |
The added files by ArchUnit are due to https://www.archunit.org/userguide/html/000_Index.html#_freezing_arch_rules, if we are looking to integrate it, this can act as a suppression file as it will contain all the violations, another method can be to create custom slices without some classes, ignoring those classes, so no violations will be received from them. |
…asses are immutable
…asses are immutable
…asses are immutable
…asses are immutable
…asses are immutable
…asses are immutable
…cks, filters and file filters are annotated
…asses are immutable
…asses are immutable
…asses are immutable
…asses are immutable
…asses are immutable
…asses are immutable
…asses are immutable
@nick-mancuso @rnveach Let's approve this. |
…s and utils are immutable and modules are correctly annotated
…s and utils are immutable and modules are correctly annotated
…s and utils are immutable and modules are correctly annotated
|
PR for |
… are immutable, and modules are correctly annotated
…ckage are not dependent on classes present in utils package
…cks only extend AbstractCheck or AbstractFileSetCheck or AbstractJavadocCheck
… and utils are immutable, and modules are correctly annotated
all changes are merged, if something else required, open new issue, |
2 items were not done at #12099 (comment) |
I pretty sure it is covered by our modifier Check.
It is covered by jarch cycle validation |
Which one https://checkstyle.org/config_modifier.html ?
Cycle is 2 way. Package 1 > Package 2 > Package 1. This was 1 way. Package 1 > Package 2. It was to represent checks don't rely on other checks. |
https://checkstyle.org/config_design.html#VisibilityModifier
I think we need to practice existing cycles tests to find how to make more advanced validation. |
While ArchUnit was introduced in #7469, we only did very basic initial integration (see #8112). We would like to expand our usage of ArchUnit.
It would be a good first step to see if we can complete the work started at #8223, without having ArchUnit add generated files to the project.
References:
https://blog.jdriven.com/2018/10/testing-the-architecture-archunit-in-practice/
https://www.mobileit.cz/Blog/Pages/arch-unit-1.aspx
https://www.mobileit.cz/Blog/Pages/arch-unit-2.aspx
https://www.mscharhag.com/software-development/architecture-validation-with-archunit
Good "alternative" uses:
https://nexocode.com/blog/posts/archunit-forget-architecture-it-s-a-flexible-and-intelligent-linter/
Let's use this issue to discuss usage ideas.
The text was updated successfully, but these errors were encountered: