2.1 KiB
2.1 KiB
Testing Guide
Cortex has two test modes:
- normal tests through
scripts\test.ps1 - local end-to-end integration tests through
scripts\test-integration.ps1
The integration tests are ordinary xUnit tests and can be run individually from Visual Studio Test Explorer.
Test Stack
The test stack is isolated from the dev stack.
| Service | Test value |
|---|---|
| Compose project | cortex-test |
| App | http://localhost:5217 |
| MCP endpoint | http://localhost:5217/mcp |
| PostgreSQL | localhost:54339 |
| Embeddings | http://localhost:8188 |
Full Integration Pipeline
.\scripts\test-integration.ps1
This performs:
- Reset test database.
- Start test db and embeddings.
- Build test app image.
- Apply migrations.
- Start test app.
- Wait for health.
- Run xUnit integration tests.
- Stop test stack unless
-KeepRunningis supplied.
Keep Test Stack Running
Use this before running individual tests from Visual Studio Test Explorer:
.\scripts\test-integration.ps1 -KeepRunning
Or deploy without running tests:
.\scripts\deploy-test.ps1
Run One Test from PowerShell
.\scripts\test-integration.ps1 -Filter "FullyQualifiedName~SearchTests"
Run Tests from Visual Studio
-
Open
Cortex.slnxin Visual Studio. -
Start the test stack:
.\scripts\deploy-test.ps1 -
Open Test Explorer.
-
Run any test in
Cortex.IntegrationTests.
The tests use:
CORTEX_TEST_BASE_URL
If that environment variable is not set, they default to:
http://localhost:5217
Test Isolation
Each integration test creates a unique project name. The scripted pipeline resets the test database before a normal run. Individual Visual Studio runs can leave data behind safely because each test uses its own project.
Current Coverage
The integration suite covers:
- health endpoint
- MCP tool discovery
- project creation
- duplicate project behavior
- missing project failure for add
- add/update/delete item
- soft delete hiding items from search
- project-scoped search isolation
- global search
- category filtering