I have JUnit 4 test classes that all inherit from a common class. This parent class provide services such as minimal tests setup and DB management.
But this parent class is long to execute mainly because my Spring context loading is slow.
Is there any way to execute the code from the parent class only once for all the tests classes that inherit from it?
You can take a look at similar question for reference:
Reuse spring application context across junit test classes
This works good with batch of tests. I personally use single configuration for all tests in one module, with small downside, which is that even if test requires only part of the context, it is still better to load whole context, so it might take more time for individual test to execute, but test run faster at batches.
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