Writing Tests
Page Status
This page is a placeholder. Content coming soon.
Patterns and conventions for the test suite.
Unit tests vs integration tests: when to use each
Unit: no I/O, no filesystem, all dependencies mocked, tests a single component in isolation
Integration: real file I/O, real assets from
Resources/, tests multiple components together
Test directory structure:
tests/unit/mirrors the source layout,tests/integration/organized by featureGoogleTest basics for contributors who have not used it:
TEST,TEST_F,EXPECT_*,ASSERT_*Custom test main (
test_main.cpp): stacktrace control with--enable-stacktraceTesting with
BufferedUserDiagnostics: inject it, run code, assert on buffered messagesTesting with generated mock configs:
MockDomainConfig,MockAppConfig,MockInfraConfigTesting
ChainableResulterror paths: checking error chains, verifying error messagesTesting domain algorithms: pure functions are trivial to test
Integration test resources: where they live (
Resources/), how to add new test fixturesRunning specific tests: GoogleTest filter flags (
--gtest_filter)Code coverage: using
Scripts/coverage.pyto verify new code paths are exercised
Cross-references: Error Handling and User Diagnostics for testing error paths, Building, Testing, and Development Workflows for running the suite and coverage