Kuali Rice Development
  1. Kuali Rice Development
  2. KULRICE-8846

Update JUnit to 4.11 to be able to specify the order the test run in, since JDK7 randomizes order

    Details

    • Type: Task Task
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.1.3
    • Component/s: Quality Assurance
    • Security Level: Public (Public: Anyone can view)
    • Labels:
      None
    • Similar issues:
      KULRICE-1367Order of RouteNodeService.getFutureNodeNames is random
      KULRICE-9582Update annotation metadata to be able to specify data objects which are not JPA-backed
      KULRICE-1865Update configs to specify KEN and KCB test mode
      KULRICE-13475Update "How To Run the Rice Unit Tests" document to describe how to run pure unit tests as well as integration tests
      KULRICE-10155Create a JUnit TestRunner which forks the classpath so that we can avoid having to code our tests around load-time weaving issues
      KULRICE-1296Add an ordering component to the unit test annotations for statements and files
      KULRICE-13455Order loadtest ci jobs to not run against env17 simulaneously
      KULRICE-9184Add 'order by' to CriteriaLookup
      KULRICE-14166Java 8 breaks JPA unit tests due to result order
      KULRICE-1433Fix the unit tests so they can be run locally
    • Rice Team:
      QA
    • KAI Review Status:
      Not Required
    • KTI Review Status:
      Not Required

      Description

      JKD7 runs tests in a random order which can expose dependencies between tests though it can be difficult to reproduce the same order (to verify the fix) JUnit 4.11 adds a class level annotation that allows you to specify the order. Need KTI approval.

        Activity

        Hide
        Corey Pedersen (Inactive) added a comment -

        Test execution order

        By design, JUnit does not specify the execution order of test method invocations. Until now, the methods were simply invoked in the order returned by the reflection API. However, using the JVM order is unwise since the Java platform does not specify any particular order, and in fact JDK 7 returns a more or less random order. Of course, well-written test code would not assume any order, but some does, and a predictable failure is better than a random failure on certain platforms.

        From now on, JUnit will by default use a deterministic, but not predictable, order (MethodSorters.DEFAULT). To change the test execution order simply annotate your test class using @FixMethodOrder and specify one of the available MethodSorters:

        @FixMethodOrder(MethodSorters.JVM): Leaves the test methods in the order returned by the JVM. This order may vary from run to run.

        @FixMethodOrder(MethodSorters.NAME_ASCENDING): Sorts the test methods by method name, in lexicographic order.

        Show
        Corey Pedersen (Inactive) added a comment - Test execution order By design, JUnit does not specify the execution order of test method invocations. Until now, the methods were simply invoked in the order returned by the reflection API. However, using the JVM order is unwise since the Java platform does not specify any particular order, and in fact JDK 7 returns a more or less random order. Of course, well-written test code would not assume any order, but some does, and a predictable failure is better than a random failure on certain platforms. From now on, JUnit will by default use a deterministic, but not predictable, order (MethodSorters.DEFAULT). To change the test execution order simply annotate your test class using @FixMethodOrder and specify one of the available MethodSorters: @FixMethodOrder(MethodSorters.JVM): Leaves the test methods in the order returned by the JVM. This order may vary from run to run. @FixMethodOrder(MethodSorters.NAME_ASCENDING): Sorts the test methods by method name, in lexicographic order.
        Hide
        Corey Pedersen (Inactive) added a comment -

        Committed revision 36964. update rice pom.xml junit version to 4.11

        Show
        Corey Pedersen (Inactive) added a comment - Committed revision 36964. update rice pom.xml junit version to 4.11

          People

          • Assignee:
            Corey Pedersen (Inactive)
            Reporter:
            Erik Meade
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Structure Helper Panel