Setting Up Integration Tests
Configure your project to support integration tests, including managing test environments and dependencies.
Integration Test Setup Intro
Welcome to setting up Integration Tests! After learning about the difference between unit and integration tests, it's time to prepare our project.
Proper setup is crucial for integration tests to run reliably. It ensures your tests are isolated, repeatable, and don't interfere with your development environment.
Separate Source Folders
The first step is to clearly separate your integration tests from your unit tests. This helps organize your codebase and allows build tools to treat them differently.
- Unit Tests: Typically reside in
src/test/java. - Integration Tests: Often placed in a dedicated folder like
src/it/javaorsrc/integrationTest/java.
This separation makes it easier to run them at different stages of your build process.
All lessons in this course
- Unit vs. Integration Tests
- Setting Up Integration Tests
- Testing Database Interactions
- Testing External APIs with WireMock