Do you really need your app's Cassandra / Persistence-Layer for this test?
If anser is not, or if the answer is not a wide range of tests, than you could add another persitsence repository when running the tests. To achieve this, you can use Spring's built-in Profile functionality and annotate your tests accordingly, for example:
@RunWith(SpringJUnit4ClassRunner.class) @ActiveProfile("StubPersistence") public class WebLayerIntegrationTests { ... }
After that, you could have a missing version of your Cassanda-Repository for your tests that can work with static data:
@Profiles("StubPersistence") @Repository public class StubCassandaRepository { ... }
This class can be supported by a simple data structure, such as a HashSet or similar, depdends in your use case. The possibility of this approach greatly affects your software architecture, so it may not be possible if you cannot drown out your Cassandra wraps.
I also wonder if you really need hundreds of tests that need your full application, including the web layer. You can, of course, significantly speed up your tests by choosing Unit-Tests over Integration-Tests, so you don't need to initialize Spring -Context. Depends on your application and software architecture.
There will also be some testing improvements in Spring-Boot 1.4 that allow you to specifically initialize individual fragments of your application for testing (e.g. Persistence or Web-Layer): https://spring.io/blog/2016/04/15/testing- improvements-in-spring-boot-1-4
So my best advice is: If you want to test your controllers, test only your controllers, not the Persistence-Layer level, turn it off instead. If you want to test your Persistence-Layer, start with the interfaces of your Persistence-Layer, do not use your controllers as a test interface.