Components can work separately and still fail where they meet. An integration test checks functional requirements across connected application parts, especially the edges between subsystems. It runs with real subsystems and services in conditions resembling production, so it can reveal behavior that an isolated functional test misses. section 15.1 section 15.1.4
That realism has a cost: integration tests can be slow, unreliable, and difficult to set up. They also cannot easily trigger a precisely timed database outage. Use mocking and dependency injection when a test needs controlled subsystem failures; use integration tests to check that the real parts work together. section 15.1.4 section 15.2.1
Test a scenario through its real interpreter
A labyrinth-generation test runs a scenario through a real runtime, then checks its bounds and the allowed ranges for wormholes and exits. The assertions check the result of integrated execution rather than replacing the interpreter with a test double. section 15.1.4
A database-backed scenario needs another safeguard. Hard-coding a production RocksDB path makes a test potentially harmful: an unproven loader could corrupt data or breach security. Pass the database configuration into the scenario instead, and run the test against a specially prepared test database. section 15.1.4
Listing 15.7 Scenario for loading a labyrinth from the KV database
loadLabyrinth :: Int -> LangL Labyrinth
loadLabyrinth labIdx =
withKVDB' kvDBConfig $ do
labVal :: LabVal <- loadEntity (LabKey labIdx) #1
pure (fromLabVal labVal)
kvDBConfig :: KVDBConfig LabKVDB
kvDBConfig = RocksDBConfig "./prod/labyrinths"
The listing makes the unsafe coupling visible: the loading scenario selects a production database path internally. section 15.1.4
Integration tests also provide early feedback while an application is incomplete. A minimum viable product can connect enough subsystems to test an idea and remain a foundation for further development. Passing integration tests supports confidence that those connected parts function together, provided the tests cover the relevant requirements. section 3.1.1 section 15.1.4
































