Skip to content
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

support executing single @ArchTest members #1280

Merged
merged 3 commits into from
Apr 10, 2024

Commits on Apr 9, 2024

  1. fix Jekyll Gemfile

    Right now the ArchUnit website can't be started locally anymore,
    because Jekyll throws an error
    
    ```
     Conversion error: Jekyll::Converters::Scss encountered an error while converting 'assets/css/main.scss': Broken pipe
    ```
    
    From what I found online Jekyll 4 has become stricter in some way.
    I don't exactly understand why, because the scss file still seems to conform to the docs,
    but since I also found that GitHub pages uses Jekyll 3.9.5 at this time anyway,
    I figured we may as well just downgrade to that version,
    which then also fixes our problem.
    
    I don't remember the original reason why we weren't using the github-pages Gem,
    but from what I see right now it seems to work exactly as specified in the docs.
    It also fixes Jekyll to the correct version.
    So, I reverted the Gemfile to use the github-pages Gem instead of the jekyll Gem.
    
    Signed-off-by: Peter Gafert <peter.gafert@archunit.org>
    codecholeric committed Apr 9, 2024
    Configuration menu
    Copy the full SHA
    13777cf View commit details
    Browse the repository at this point in the history
  2. support filtering @ArchTest members by system property for JUnit 5

    One inconvenience of the current state of the `ArchUnitTestEngine`
    is the fact that there is no simple way to execute a single rule.
    For methods annotated with `@ArchTest` this might be supported by the IDE,
    but for fields there is no convenient way except of commenting all other `@ArchTest` annotations.
    
    We now provide a simple way to run any member in isolation
    by specifying a system property / `ArchConfiguration` value.
    This change allows to pass a simple test name filter
    that for now only supports exact member matches.
    E.g. specifying `-Darchunit.junit.testFilter=my_custom_rule` would run the rule
    declared in a field or member with name `my_custom_rule`.
    Multiple members can be joined by `,` and are then all executed in one run.
    
    Signed-off-by: Peter Gafert <peter.gafert@archunit.org>
    codecholeric committed Apr 9, 2024
    Configuration menu
    Copy the full SHA
    5740ed8 View commit details
    Browse the repository at this point in the history
  3. support filtering @ArchTest members by system property for JUnit 4

    One inconvenience of the current state of the `ArchUnitRunner`
    is the fact that there is no simple way to execute a single rule.
    For methods annotated with `@ArchTest` this might be supported by the IDE,
    but for fields there is no convenient way except of commenting all other `@ArchTest` annotations.
    
    We now provide a simple way to run any member in isolation
    by specifying a system property / `ArchConfiguration` value.
    This change allows to pass a simple test name filter
    that for now only supports exact member matches.
    E.g. specifying `-Darchunit.junit.testFilter=my_custom_rule` would run the rule
    declared in a field or member with name `my_custom_rule`.
    Multiple members can be joined by `,` and are then all executed in one run.
    
    Unfortunately, filtering in JUnit 4 is tied to only the `Description` of the current test.
    Since we don't want to couple text parsing of the description to filtering
    (e.g. if we change the description in the future),
    we have to introduce a hack to transmit the original member name to the `Filter`.
    Due to the fact that `Description` is effectively final and has no intended way for our
    use case, we (ab-)use the `annotations` of the test member to pass along the information
    in a custom annotation. This should have no further effect, since no infrastructure can
    react to unknown annotations, which may be present at any time for given tests.
    
    Signed-off-by: Peter Gafert <peter.gafert@archunit.org>
    codecholeric committed Apr 9, 2024
    Configuration menu
    Copy the full SHA
    14d7f4d View commit details
    Browse the repository at this point in the history