Reputation: 812
We have Spring Boot application and we have integration tests using JUnit 4 and RestAssured Framework.
We have a lot of test related classes in our project.
Our integration tests take a long time to run locally, because each class bootstraps and brings the server - which runs the tests in the class and then terminates the server.
This happens for each class.
Bringing up the server and killing the server each time takes a lot of time - which makes running all the tests together really slow.
I would like the server to launch locally only once - and all tests to be run against it.
So basically my use case is when i am trying to run all tests at once.
Thanks in advance
Best Regards
Upvotes: 6
Views: 2405
Reputation: 1180
Integration tests are typically slow. But to maintain test independence it is not always an option to move test preparation and cleaning outside of the test.
How about making the tests run in parallel? See for Gradle. This can be done in Maven as well I think.
Yes, that usually introduces a new set of troubles, like making sure that tests that run at the same time do not influence each other. Usually the ports used need to be test specific, usually providing 0 will imply: find a free port. During the test the actually used port can be retrieved.
The total speed up may be better this way, while maintaining testing independence.
Upvotes: 1