Short summary
Testing strategies and frameworks observed in the repository.
Test types & locations
- Unit tests:
service/Api/tests/Module.UnitTestsandShared.UnitTestsuse EF Core InMemory / Moq. - Integration tests:
service/Api/tests/Api.Testsuse Testcontainers (PostgreSQL + Redis) and require Docker. - HTTP tests:
ApiTests/contains.httpfiles for manual REST Client usage. - Frontend tests: Vitest in
app/Admin/src/__tests__/andapp/Store/src/__tests__/. - Python tests: pytest in
service/Embedding/.
Commands
- Build + test:
dotnet buildanddotnet test.
Evidence
ApiTests/README.mdservice/Api/tests/Api.Tests/Api.Tests.csprojservice/Api/tests/Module.UnitTests/Module.UnitTests.csprojservice/Api/tests/Shared.UnitTests/Shared.UnitTests.csprojReSys.Shop.slnx
[ASK USER]
- No CI pipeline exists. What is the team's priority and preferred platform (GitHub Actions, Azure DevOps, etc.) for automated build/test?
- Primary test frameworks:
- .NET: xUnit v3 (3.2.2) via Microsoft.Testing.Platform (
global.json:7,Directory.Packages.props:110) - Frontend: Vitest (4.1.9) (
app/Admin/package.json:56,app/Store/package.json:50) - Python: pytest (>=8) (
service/Embedding/pyproject.toml)
- .NET: xUnit v3 (3.2.2) via Microsoft.Testing.Platform (
- Assertion/mocking tools:
- .NET: FluentAssertions (8.10.0), Moq (4.20.72) (
Directory.Packages.props:104-105) - Frontend: @vue/test-utils (2.4.11), jsdom for DOM simulation
- .NET: FluentAssertions (8.10.0), Moq (4.20.72) (
- Commands:
# Run all .NET tests (unit + integration)
dotnet test
# Unit tests only (fast, no Docker)
dotnet test service/Api/tests/Module.UnitTests
# Integration tests only (requires Docker)
dotnet test service/Api/tests/Api.Tests
# Run filtered tests
dotnet test --filter "FullyQualifiedName~Location"
# Run tests with coverage
dotnet test /p:CollectCoverage=true
# Frontend — Admin SPA
cd app/Admin && pnpm run test:unit
# Frontend — Store SPA
cd app/Store && pnpm run test:unit
# Python embedding service
cd service/Embedding && uv run pytest- Test file placement pattern: Separate test projects (not co-located with source)
- .NET integration tests:
service/Api/tests/Api.Tests/— organized asScenarios/{Module}/{Admin|Storefront}/{Feature}/ - .NET unit tests:
service/Api/tests/Module.UnitTests/— mirrorsModule/structure (Catalog/Features/{Admin|Storefront}/,Identity/,Location/, etc.) - .NET shared unit tests:
service/Api/tests/Shared.UnitTests/— mirrorsShared/structure (Application/,Governance/,Security/, etc.) - Frontend tests:
src/__tests__/co-located within SPA projects —app/Admin/src/__tests__/,app/Store/src/__tests__/ - HTTP tests:
ApiTests/— organized as{Module}/{Admin|Storefront}/*.http
- .NET integration tests:
- Naming convention:
- .NET test classes:
*Tests.csor*.Tests.cs— e.g.,Country.Extensions.Tests.cs,GetProductDetail.Tests.cs,Country.Configuration.Tests.cs - .NET test files are typically co-located in feature folders with the format
{Action}.Tests.cs— e.g.,Create/Country.Create.Tests.cs - Integration tests use
*.IntegrationTests.cspattern — e.g.,ListProducts.IntegrationTests.cs - Frontend test files:
*.spec.ts— e.g.,App.spec.ts,cart.store.spec.ts
- .NET test classes:
- Setup files and where they run:
GlobalUsing.csin each test project — shared usings for all test filesApi.Tests/Infrastructure/ApiIntegrationTestBase.cs— base class for integration tests (providesWebApplicationFactory, Respawn DB reset)Api.Tests/Infrastructure/ModuleIntegrationTestBase.cs— base class for module-scoped integration testsApi.Tests/Infrastructure/ApiCollection.cs+ApiFixture.cs— shared test collection for xUnitxunit.runner.jsonin each test project — xUnit v3 configuration- Frontend:
vitest.config.tsper SPA project
| Scope | Covered? | Typical target | Notes |
|---|---|---|---|
| Unit | Yes | Domain entity methods, validators, mappers, pipeline behaviors | Module.UnitTests and Shared.UnitTests — EF Core InMemory for data access, Moq for interfaces. ~750+ test classes (*Tests.cs) across all .NET test projects. |
| Integration | Yes | Full API request/response flows, database interactions | Api.Tests — uses Testcontainers (PostgreSQL + Redis) with real infrastructure. DB state reset via Respawn per test class. |
| E2E | No | Cross-service user journeys | [TODO] — No end-to-end tests covering Aspire-orchestrated multi-service flows (API + Embedding + Frontends) |
| HTTP (manual) | Partial | API endpoints via .http files | ApiTests/ directory with organized .http files for manual testing in REST Client. Requires running API with seeded data. |
| Frontend component | Partial | Vue component rendering and store logic | Store SPA has App.spec.ts and cart.store.spec.ts; Admin SPA has only App.spec.ts. No comprehensive component test suite. |
| Python | Yes | Embedding service routes and logic | pytest with httpx for HTTP testing; [TODO] — exact coverage unknown, tests not inspected |
- Main mocking approach:
- .NET: Moq for interface mocking, EF Core InMemory for database in unit tests (no real database)
- .NET integration tests: Real PostgreSQL and Redis via Testcontainers Docker containers
- Frontend: @vue/test-utils with jsdom for component mounting and DOM simulation
- Isolation guarantees:
- Integration tests: DB state reset via Respawn per test class (
ApiIntegrationTestBase), ensuring clean state for each test class - Unit tests: EF Core InMemory database recreated per test (state not shared between tests)
- xUnit collections:
ApiCollectiongroups tests sharing the same Testcontainers instance to avoid per-test container startup overhead
- Integration tests: DB state reset via Respawn per test class (
- Common failure mode in tests: Integration tests require Docker to be running; without Docker, all
Api.Testswill fail with container startup errors
- Coverage tool + threshold:
- .NET: Coverlet (10.0.1) — coverage is opt-in (
/p:CollectCoverage=true). Output format: Cobertura + JSON tocoverage/directory (Directory.Build.props:95-97) - Frontend: @vitest/coverage-v8 (4.1.7) — available but not yet configured with thresholds
- No minimum coverage threshold is enforced in CI (no CI pipeline exists)
- .NET: Coverlet (10.0.1) — coverage is opt-in (
- Current reported coverage: [TODO] — no recent coverage reports available
- Known gaps/flaky areas:
- Admin SPA has almost no tests (only placeholder
App.spec.ts) - Store SPA has minimal test coverage (2 spec files)
- Embedding service test coverage is unknown
- HTTP tests (.http files) are manual-only, not automated
- No E2E test infrastructure exists
- No CI pipeline to run tests automatically on push/PR
- Admin SPA has almost no tests (only placeholder
service/Api/tests/Api.Tests/Api.Tests.csproj— Integration test project with Testcontainers + Respawn dependenciesservice/Api/tests/Module.UnitTests/Module.UnitTests.csproj— Unit test projectservice/Api/tests/Shared.UnitTests/Shared.UnitTests.csproj— Shared infrastructure unit testsservice/Api/tests/Api.Tests/Infrastructure/ApiIntegrationTestBase.cs— Integration test base classservice/Api/tests/Api.Tests/Infrastructure/ApiFactory.cs— WebApplicationFactory for APIservice/Api/tests/Api.Tests/Infrastructure/ApiFixture.cs— Shared test collection fixtureDirectory.Build.props:87-98— Test project auto-detection, coverage configuration, suppressed warningsglobal.json:6-8— Test runner configuration (Microsoft.Testing.Platform)Directory.Packages.props:108-112— Testcontainers, Respawn, xUnit versionsapp/Admin/vitest.config.ts— Admin SPA test configurationapp/Store/vitest.config.ts— Store SPA test configurationApiTests/README.md— HTTP test documentation