Spring brings a few options in order to test web applications, and most Spring developers are familiar with them, these are:
MockMvc: Mocks the servlet API, useful for non-reactive web apps
TestRestTemplate: Can be used pointing to our app, useful for non-reactive web apps where mocked servlets are not desirable
WebTestClient: Is a testing tool for reactive web apps, both with mocked requests/responses or hitting a real server
Using profiles wisely – how profiles impact performance
Reconsidering @MockBean – how mocking hits performance
Refactoring @MockBean – alternatives to improve performance
Thinking carefully about @DirtiesContext – a useful but dangerous annotation and how not to use it
Using test slices – a cool tool that can help or get on our way
Using class inheritance – a way to organize tests in a safe manner
State management – good practices to avoid flakey tests
Refactoring into unit tests – the best way to get a solid and snappy build