Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-21566

Move from JUnit 4 to JUnit Jupiter 5/6 (epic)

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 39.0.1.Final
    • Test Suite
    • None
    • ---
    • ---

      This issue intends to track move from JUnit 4 to JUnit Jupiter 5/6 across the WF codebase. We have put the work in on the ARQ side to make this possible, so we are ready to move. This Jira also provides simple summary of changes to make.

      Summary of required and optional best practice changes:

      • swap @RunWith(Arquillian.class) -> @ExtendWith(ArquillianExtension.class) (required)
      • asserts now have different parameter order (required)
      • methods no longer need to be public unless intended for override (best practice)
      • JUnit 5 annotation inheritance doesn't work across packages or overrides - moved @OperateOnDeployment from method level to the parameter — JUnit 5 only looks at parameter annotations, not method-level ones (required)
      • drop 'test' from method names e.g. testGracefulSimpleFailover → gracefulSimpleFailover (best practice)
      • fix previously ignored spurious @Test on non-test helper methods (which would now fail) (required)
      • swap arquillian-extension-byteman → byteman-bmunit5 (required)
      • swap org.jboss.arquillian.extension.byteman.api.@BMRule/@BMRules imports → org.jboss.byteman.contrib.bmunit (what byteman-bmunit5 actually processes) (required)
      • swap @WithByteman — the JUnit 5 equivalent of @RunWith(BMUnitRunner.class) (required)

      The openrewrite recipes to use:

                          <activeRecipes>
                              <recipe>org.openrewrite.java.testing.junit5.JUnit4to5Migration</recipe>
                              <recipe>org.openrewrite.java.testing.junit5.JUnit5BestPractices</recipe>
                              <recipe>org.openrewrite.java.testing.arquillian.ArquillianJUnit4ToArquillianJUnit5</recipe>
                          </activeRecipes>
      

      n.b. intentionally not using 'migrate' here as that's overloaded.

      Testsuite Path JUnit Version Jira Comments
      integration/clustering JUnit 5 ✓ WFLY-21567 PR open
      integration/smoke JUnit 5 ✓ WFLY-20746 Done by James long time ago
      integration/basic JUnit 4 TODO
      integration/elytron JUnit 4 TODO
      integration/elytron-oidc-client JUnit 4 TODO
      integration/expansion JUnit 4 TODO
      integration/iiop JUnit 4 TODO
      integration/legacy JUnit 4 TODO
      integration/manualmode JUnit 4 TODO
      integration/manualmode-expansion JUnit 4 TODO
      integration/microprofile-tck JUnit 4 TODO TCK suite, no Arquillian dependency
      integration/multinode JUnit 4 TODO
      integration/rbac JUnit 4 TODO
      integration/rts JUnit 4 TODO
      integration/secman JUnit 4 TODO
      integration/vdx JUnit 4 TODO
      integration/web JUnit 4 TODO
      integration/ws JUnit 4 TODO
      integration/xts JUnit 4 TODO
      domain JUnit 4 TODO
      mixed-domain JUnit 4 TODO
      preview JUnit 4 TODO

              rhn-engineering-rhusar Radoslav Husar
              rhn-engineering-rhusar Radoslav Husar
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: