A test suite groups related tests around a system under test (SUT). Each test supplies inputs, execution conditions, and expected results; together, the tests verify happy paths and edge cases for a class, architectural layer, or entire application. section 7.2.1
Use suite lifecycle hooks to control shared state and per-test isolation:
- Before each test, create or reset test-specific dependencies such as mocks. section 7.3.1
- After each test, remove files, folders, or other state that could affect the next test. section 7.3.1
- Before all tests, initialize shared resources such as a database or Testcontainers environment. section 7.3.1
- After all tests, destroy shared resources and leave the environment clean. section 7.3.1
Testing an order database adapter
Define an OrderDatabaseTestSuite struct embedding suite.Suite, then use SetupSuite to start a MySQL 8.0.30 container with testcontainers-go and wait for its SQL endpoint. Add tests that save an order and retrieve it to verify the customer ID, and run the receiver-based tests with suite.Run. Execute the suite with `go test ./...`. section 7.3.2
Shows how related happy-path and edge-case tests combine to verify one system under test. section 7.2.1










