I am using AbstractTransactionalSpringContextTests to run spring integrations tests. The spring context is loaded just once and then all the tests are run. How do I do the same if I want my tests to be in many classes and packages.
Of course, the spring context should be loaded just once for all my tests (in all classes and packages), and not once per class or package.
As the Javadocs for
AbstractSingleSpringContextTests(one of the superclasses ofAbstractTransactionalSpringContextTests) state:Your context is cached, so all other tests that run within the same classloader (i.e. – all your other tests that run during the same test run) will use the cached context. You don’t need to do any extra setup – should be done for you already. If you’re not sure about this, or wish to troubleshoot, simply turn on the logging for org.springframework and you should see plenty of helpful logging about when the context is being loaded, which file, how; etc.