Speeding up Spring testing

Good evening,

I have JUnit 4 test classes that inherit from a generic class. This parent class provides services such as minimal test setup and database management.

But this parent class takes a long time to execute mainly because Spring context loading is slow.

Is there a way to execute code from the parent class just once for all test classes that inherit from it?

Hello,

alien

+3


source to share


1 answer


You can take a look at a similar question for reference:

Reuse spring application context in junit class classes



This works well with a batch of tests. I personally use a single configuration for all tests in one unit with a slight drawback, and even if a test only requires a portion of the context, it is still better to load the entire context, so it may take longer for an individual test to run, but the test is faster in batches.

+2


source







All Articles