Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-16630

Migrate to JUnit5

Agile BoardAttach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments


    • Type: Improvement
    • Status: Open
    • Priority: Low
    • Resolution: Unresolved
    • Fix Version/s: None
    • Component/s: Test/unit
    • Labels:
    • Change Category:
      Quality Assurance
    • Complexity:
    • Platform:
    • Impacts:



      Currently C* uses JUnit4 (version 4.12) which is obsolete. There is a newer version 4.13.2 which we could update to. However, JUnit4 is generally considered to be outdated and it is reasonable to migrate to JUnit5.

      Despite of having a syntax sugar in JUnit5 (assertThrow, lamda's support, ect), there are no blockers that push us to move from JUnit4. The main motivation for this initiative is rule of thumb to use up-to-date versions of the dependencies.

      Obviously this change is not backward compatible with the open PRs and previous C* versions. Therefore, it will require an additional effort for backporting the changes and updating PRs that have tests. However, I believe it should not be a blocker for this initiative.

      Scope (preliminary list)

      1. change JUnit4 to JUnit5 dependencies and make necessary changes in ant tasks (https://ant.apache.org/manual/Tasks/junitlauncher.html)
      2. update syntax in all tests (imports, Before/After annotations, etc)
      3. update parameterized tests
      4. create a new version of OrderedJUnit4ClassRunner and update corresponding tests
      5. update tests that use BMUnitRunner (as per https://developer.jboss.org/docs/DOC-52953 it supports JUnit5)
      6. update tests with @Rule
      7. update tests with expected exceptions
      8. update JStackJUnitTask
      9. update formatters
      10. create a separate ticket to migrate to ant-junitlauncher-1.10.11 (once it is released) and simplify JStackJUnitTask after https://github.com/apache/ant/pull/147

      Order of operations

      In order to make the transition more smooth we want to use a phased approach:

      1. migrate to JUnit5 with Vintage Engine, so all JUnit4 tests work as is
      2. update tests in a few bunches (to not have a huge single PR with numerous conflicts)
      3. disable (remove dependency) Vintage Engine, so only JUnit5 tests work


        Issue Links



            • Assignee:
              azotcsit Aleksei Zotov Assign to me
              azotcsit Aleksei Zotov
              Aleksei Zotov


              • Created:

                Issue deployment