Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8328629

JUnit test without a timeout value can hang indefinitely

XMLWordPrintable

    • b11

      The JUnit `@Test` annotation takes an optional timeout parameter that will abort the test after a certain amount of time.

      In the absence of this optional parameter, gradle's test runner, which is used to run our JUnit tests, will run indefinitely. We should explore whether there is a way to set a default timeout when one is not specified.

      The lack of such a global timeout is a problem when running automated tests using a Jenkins (or similar) build system.

      WORKAROUND: The only feasible workaround is to have a global job timeout on the Jenkins job. That is problematic since the timeout would need to be very long (on the order of 4 hours) to ensure that a build and test run done on a slower system was never killed prematurely.

            kcr Kevin Rushforth
            kcr Kevin Rushforth
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: