Integration Test Scenarios
Integration test scenarios provide deterministic, multi-object DataManager fixtures for tests that need realistic neuroscience-style data — especially tensor/table building, cross-timeframe alignment, and statistical pipelines.
This page describes when to use scenarios, how they relate to other fixture layers, and where to find documented scenarios.
When to use a scenario
| Approach | Best for | Location |
|---|---|---|
| Builders | Constructing a single data object without DataManager |
tests/DataManager/fixtures/builders/ |
| Test vectors | Algorithm parity with explicit input + expected output rows | tests/DataManager/fixtures/vectors/ |
| Scenarios | Correlated multi-signal setups with known statistical structure | tests/DataManager/fixtures/scenarios/ |
| Catch2 fixtures | Thin wrappers that populate DataManager from a scenario |
tests/DataManager/fixtures/*_test_fixture.hpp |
Use a scenario when your test needs several named data objects on different timeframes with controlled correlations (e.g., elevated spike rate during contact intervals). For single-transform unit tests with hand-verified outputs, prefer test vectors.
Architecture
Scenarios follow the three-layer pattern documented in tests/DataManager/fixtures/README.md:
tests/DataManager/fixtures/
├── builders/ # TimeFrameBuilder, AnalogTimeSeriesBuilder, ...
├── stochastic/ # Reusable RNG utilities (AR(1), Poisson thinning, ...)
├── scenarios/
│ └── <domain>/ # Scenario config + generator + assertions
└── <name>_test_fixture.hpp # Optional Catch2 fixture
A typical scenario provides:
ScenarioConfig— reflectable or plain struct with defaults and derived countsScenario::generate(config)— returns data objects (noDataManagerdependency)Scenario::populate(dm)— registers timeframes and data keysScenarioAssertions.hpp— statistical checks for TDD (reproducibility, correlation structure)- Tests — structure, reproducibility, and property validation
Stochastic utilities live under fixtures/stochastic/ as header-only helpers so test_data_manager and test_TransformsV2 can share them without linking DataSynthesizer.
Using a scenario in a test
#include "fixtures/whisker_contact_test_fixture.hpp"
TEST_CASE("My integration test", "[my_feature][whisker_contact]") {
WhiskerContactScenarioConfig cfg;
cfg.duration_sec = 10.0;
WhiskerContactTestFixture fixture(cfg);
auto& dm = fixture.dm();
auto const& scenario = fixture.scenario();
// dm has Spikes, Contact, Curvature, Angle on Master / Time clocks
}Or generate without the fixture:
#include "fixtures/scenarios/neural/WhiskerContactScenario.hpp"
auto scenario = WhiskerContactScenario::generate({});
DataManager dm;
scenario.populate(dm);Specifying tensors from JSON
After a scenario (or any data load) populates DataManager, lazy-column tensors can be built from a JSON design envelope via the Qt-free TensorDesign library. The format matches TensorDesigner save/load files.
See Whisker contact — JSON example for a full cross-timeframe tensor spec.
Planned per-column gather geometry (onset windows, point samples) is described in Column row pipeline design, with implementation steps in the Column row pipeline roadmap.
Running scenario tests
Build and run with the my-clang-release preset:
cmake --build --preset my-clang-release > build_log.txt 2>&1
# Catch2 tag filter (bundled test binaries)
out/build/Clang/Release/bin/test_data_manager "[whisker_contact]"
out/build/Clang/Release/tests/TransformsV2/test_TransformsV2 "[whisker_contact]"Documented scenarios
| Scenario | Domain | Timeframes | Primary use |
|---|---|---|---|
| Whisker contact | Neural / whisker | Master (30 kHz), Time (500 Hz) |
Tensor column builders, contact-aligned spike analysis |
Adding a new scenario
- Add
fixtures/scenarios/<domain>/<Name>ScenarioConfig.hppwith defaults and derived helpers. - Add
fixtures/scenarios/<domain>/<Name>Scenario.hppwithgenerate()andpopulate(). - Extract reusable RNG logic into
fixtures/stochastic/when it is not scenario-specific. - Add
fixtures/scenarios/<domain>/<Name>ScenarioAssertions.hppfor statistical TDD checks. - Add tests in
tests/DataManager/test_<name>_scenario.cppand register intests/DataManager/CMakeLists.txt. - Add a page under
docs/developer/testing/scenarios/and link it from this index.
Future work may promote stochastic helpers to DataSynthesizer generators; scenarios should remain thin composition layers on top.