Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-3212

JUnit retry Rule, for integration tests mostly

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • Commons Testing 2.0.14
    • Commons Testing 2.0.16
    • Testing
    • None

    Description

      Some of our integration tests have been randomly failing from time to time, and with the move to Oak which has slightly different reaction times, especially in JCR observation, this is a more obvious problem.

      Those tests usually assume that changing things in Sling has immediate effects, and this is not always the case, while uploading or changing scripts or configurations for example. There might be slight delays which are not problematic in real use, but can make such tests fail. Retrying the tests, with a small configurable delay between retries, should take care of those problems.

      I'll attach a prototype JUnit Rule that enables test retries by just instantiating the Rule in the test and adding an @Rule annotation to methods that need it.

      My current plan is to add this Rule to our commons/testing module, and we'll also need to slightly rework our base test classes to make them usable in JUnit4-style tests, which is required to use Rules.

      Attachments

        1. SLING-3212-proof-of-concept.patch
          17 kB
          Bertrand Delacretaz

        Issue Links

          Activity

            People

              bdelacretaz Bertrand Delacretaz
              bdelacretaz Bertrand Delacretaz
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: