vendredi 22 juin 2018

How to run the same SpringBootTests for different applications

I have a SpringBoot multimodule application, something like that:

core customer1 -> depends on core customer2 -> depends on core

I want to write integration tests for both, but I don't want to duplicate my core test code. Now I have an abstract class with SpringBootTest(classes = Customer1Application.class) and a lot of test classes, mostly testing the core functionality.

@ContextConfiguration
@SpringBootTest(classes = Customer1Application.class)
@AutoConfigureMockMvc
public abstract class AbstractSpringBootTest
{

@Autowired
protected MockMvc                               mockMvc;

@Autowired
protected Validator                             validator;

...
}

I want to check if the changes in Customer2 application break something in core functionality, so I want to run these tests with @SpringBootTest(classes = Customer2Application.class) annotation.

How is it possible to configure the application class in the annotation? Is there a way to run the tests with my other application context without manually changing the annotation or duplicating all the steps?

Aucun commentaire:

Enregistrer un commentaire