Spring-test provides annotation for loading spring context during test runs. For example there is a org.springframework.test.context.junit4.SpringJUnit4ClassRunner
junit runner class and org.springframework.test.context.ContextConfiguration
annotation for specify context loading. For integration tests context loading can be quite long and during debugging it is needed to run same test dozen times until it "lose" all it's errors. Is there a way to do so without loading context multiple times? For example I finished debugging context loading, then run that context and start running test in intellij idea? Is that possible with Intellij Idea?
Long time ago without answer, which is strange, and this is very important to know because it can save a lot of resources and time.
If you have one class with annotation
@SpringBootTest
public class IntegrationTest
And you extend it to all your Test classes context will be loaded only once
public class ServiceIntegationTest extends IntegrationTest
All tests in this class will use same context. Also all classes that extend this class will reuse same context.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With