API BDD Testing
BDD_Tésts // Sýstém_Dóc
ᚠ ᛫ ᛟ ᛫ ᚱ ᛫ ᛒ ᛫ ᛟ ᛫ ᚲ
Overview
Cortex API with BDD-driven tests using a Haskell-based runner (Cabal) for Cortex-first development, then broader API coverage. Local development target: run a Cortex feature suite against a running API server on API_BASE_URL.
Current Status
- Cortex BDD harness skeleton wired into a Cabal-based Haskell project.
- Cortex feature present in
api/tests/bdd/features/cortex.featureand a minimal Runner inapi/tests/bdd/hs. - Scaffolding (Mock Handlers) implemented for Agents, Memory, Bridge, Soul, and Ghost domains.
- First pass focuses on Cortex; broader coverage enabled via the
cortex-bddrunner.
Build and Run (Cortex-first)
- Build the Haskell BDD harness:
cd api/tests/bdd/hs && cabal v2-build - Run Cortex feature runner:
cabal v2-run cortex-bdd - API_BASE_URL environment variable points to the API under test (default http://localhost:8080)
- To test a specific feature file:
cabal v2-run cortex-bdd -- ../../path/to/feature.file
Environment
- API_BASE_URL: Full base URL of the API under test. Example: http://localhost:8080. Defaults to http://localhost:8080 if not set.
Feature Files
This directory contains Gherkin-style BDD feature files (cortex, agents, memory, bridge, soul, ghost) for the ForbocAI API.
- Each feature represents a user story mapped to an API endpoint.
- Scenarios are intentionally skeletons; implementation wires up FP-based handlers that satisfy the scenarios.
Haskell Harness
api/tests/bdd/hshosts a Cabal-based Haskell BDD harness skeleton.- Cortex feature is wired up as the starting point.
- Harness parses Gherkin feature files (via haskell-gherkin) and drives an Hspec-based test suite.
- Step implementations:
api/tests/bdd/hs/Steps/Cortex.hsprovides skeleton steps wired to the haskell-gherkin runner. Replace no-op stubs with real HTTP calls against API_BASE_URL.
Next Steps
- Wire haskell-gherkin parser to parse cortex.feature and future features.
- Build Step registry mapping Gherkin steps to Cortex HTTP calls and validations.
- Flesh out Cortex step definitions to perform actual POST/GET HTTP requests and JSON assertions.
- Expand to additional domains (Agents, Memory, Bridge, Soul, Ghost) with similar pattern.