I have a set of Integration Tests which I want to run in suite. As of now all IT have runner annotated @RunWith(SpringJUnit4ClassRunner.class).
Also I have used test containers for Postgres and Casandra. My requirement here is that all ITs are using the same Spring context. So, I do not want to re-create spring context for each IT.
Better run them in a suite.
- Start Postgres as test container. Run DDL and DML scripts.
- Start Casandra as test container. Run DDL and DML scripts.
- Instantiate Spring Context before suite.
- Run test1 and assert.
- Run test2 and assert.
. . . . and so on . . . . - Delete Spring Context.
- Drop Casandra test container.
- Drop Postgres test container.
What is the way I can use @RunWith(SpringJUnit4ClassRunner.class) on Suite class instead of test class.