Basics Flashcards
What are Integration Tests
An integration test is supposed to test whether different modules are bounded correctly and if they work as expected.
The application shall run in ApplicationContext and run tests in it.
@SpringBootTest
Spring boot provides @SpringBootTest annotation, which starts the embedded server, creates a web environment and then enables @Test methods to do integration testing. Use its webEnvironment attribute for it. It also creates the ApplicationContext used in the tests.
Separate profile
Ideally, we should keep the integration tests separated from the unit tests and should not run along with the unit tests. We can do this by using a different profile to only run the integration tests. A couple of reasons for doing this could be that the integration tests are time-consuming and might need an actual database to execute.