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

Run ArchUnit tests using extended support for JUnit 5 in continuous testing #23355

Closed
famod opened this issue Feb 2, 2022 · 1 comment · Fixed by #23358
Closed

Run ArchUnit tests using extended support for JUnit 5 in continuous testing #23355

famod opened this issue Feb 2, 2022 · 1 comment · Fixed by #23358
Labels
Milestone

Comments

@famod
Copy link
Member

famod commented Feb 2, 2022

Description

ArchUnit tests written in the following manner are not picked up by continuous testing:

@AnalyzeClasses(packages = "com.myapp")
public class ArchitectureTest {

    // ArchRules can just be declared as static fields and will be evaluated
    @ArchTest
    public static final ArchRule rule1 = classes().should()...

    @ArchTest
    public static final ArchRule rule2 = classes().should()...

    @ArchTest
    public static void rule3(JavaClasses classes) {
        // The runner also understands static methods with a single JavaClasses argument
        // reusing the cached classes
    }
}

(taken from https://www.archunit.org/userguide/html/000_Index.html#_junit_support)

q_ct-archunit.zip contains a single AU test and continous testing displays: "No tests found". mvn test does execute the test (and it fails deliberately).

I played around with JunitTestRunner and with a few additional lines the class is discovered, but somewhere in the depths of JUnit something doesn't work as expected and the TestPlan seems to be empty.
I also tried loading AU parent-first, because there is a special engine: https://github.com/TNG/ArchUnit/blob/main/archunit-junit/junit5/engine/src/main/java/com/tngtech/archunit/junit/ArchUnitTestEngine.java
But no luck so far.

Implementation ideas

No response

@famod famod added the kind/enhancement New feature or request label Feb 2, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Feb 2, 2022

/cc @stuartwdouglas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants