Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-7996

Improve documentation of the context caching mechanism in the TestContext framework

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: 2.5.6, 3.0.5
    • Fix Version/s: 3.1 RC2
    • Component/s: [Documentation], Test
    • Labels:
      None

      Description

      Overview

      Unit/integration test execution libraries can sometimes be configured to execute tests in a forked manner (see surefire's forkMode configuration). When tests are run in a forked mode, in-memory @ContextConfiguration caching no longer applies, and the context will be reloaded for every forked process.

      The Spring reference manual merely states that @ContextConfiguration is cached and does not go into much detail beyond that. I think it would be good to specify that the cache is in-memory and thus will only be usable for tests which run within the same JVM process / class space. Perhaps a Spring note (the ones with the little leaf icon and block quote styling) would be good to call this out in the Testing chapter.

      To Document

      • cache key generation, including a discussion of the algorithm in MergedContextConfiguration
      • cache scope and implications in a test suite, including a discussion of forking

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sbrannen Sam Brannen
                Reporter:
                temujin_12 Caleb Jones
                Last updater:
                Trevor Marshall
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  6 years, 26 weeks, 3 days ago