Job Opening for Tester of Web Apps at Moolya >>Could you spot this? This is intentional!

Integration Testing with Spring – Nested Configurations

In this series we're taking at Spring and its features supporting testing in general, and specifically integration testing. Dependency Injection Configurations Nested configurations Let’s dig deeper into configurations for integration tests in Spring. We’ll start with a nested integration context example, for a class (that might be a test class, because that’s our main focus). While we can use @Import, if we set up one-time configuration, it could be nested in the test class. Here’s an example:@RunWith(SpringRunner.class) @SpringBootTest public class OurControllerTests{ @Autowired OurController controller; @Autowired OurDependency mockDependency; @Configuration @Import(ControllerConfiguration.class) static...


Share |

Published By: The Testing Planet - Wednesday, 5 December