Skip to main content

Overview

Mirobody’s tests are C++ unit tests written with Catch2 v3, living under tests/ and compiled into a single mirobody_tests binary. They are built by default and discovered by CTest.
The tests are a C++ Catch2 suite — the *_test.cpp files under tests/.

Running tests

Tests build as part of the normal build (the MIROBODY_BUILD_TESTS CMake option defaults to ON, except on Android / iOS):
Or run the test binary directly and use Catch2’s filtering:
On Windows the binary is build\tests\mirobody_tests.exe. The build dir name follows your backend selector (e.g. build_sqlite/tests/mirobody_tests).

Test layout

Tests mirror the src/ module tree. Current coverage includes: The test target links the self-registering objects (mcp_tools, mcp_resources, agent_impls) directly, the same way the app targets do — that’s what lets the registration tests observe compiled-in tools and agents.

Writing a test

Add a *_test.cpp under the matching tests/<module>/ directory, then list it in tests/CMakeLists.txt in the add_executable(mirobody_tests ...) sources.
Tag tests with [module] so they can be selected (mirobody_tests "[units]").

What the unit suite covers — and what it doesn’t

  • Pure / DB-free logic (the units engine, the FHIR resource validator, SSE parsing, PKCE, JWT, HMAC signing) is covered by fast unit tests with no external dependencies.
  • DB-backed paths (the FHIR REST handlers, chat persistence) are exercised end-to-end against a running server with a database, not in the unit binary.
  • Vendor clients have no unit tests in the suite — they call live third-party APIs, so they’re verified manually against a running server (see Provider Testing). Their metadata (VendorInfo) is credential-free and could be asserted, but transport is validated by hand.

Continuous integration

CI runs the build and tests on push. The pipeline is defined in the repository’s CI config (.gitlab-ci.yml). (verify the exact jobs in the repo.)

Next steps

Contributing

Build and change workflow

Provider Testing

Verify a vendor client by hand

Provider Integration

Add a new vendor::Vendor

File Processing

The transcoder and its tests