GhaylStackDocumentationv1.0.2
العربيةWebsite
Testing

Testing

Run and extend the test suites

Choose the right verification layer and distinguish mocked UI tests from a real application journey.

Choose the test for the risk

GhaylStack separates architecture rules, unit behavior, database-backed integration tests and browser tests. Use the smallest layer that can prove the changed behavior, then include the integration boundary that the change affects. Re-running an unrelated large suite does not replace a missing authorization or migration case.

Suite What it proves Main prerequisite
Architecture.Tests Dependencies, contracts and structural conventions Matching .NET SDK
Module and framework test projects Domain, validation and service behavior Matching SDK; some PDF tests need Chromium
Integration.Tests API, persistence, tenant and permission behavior Docker and test services
Integration.Middleware.Tests Production-like middleware behavior in a separate host Integration prerequisites
Admin/Dashboard Playwright Browser journeys with routed API mocks Node dependencies and Chromium

Run focused backend checks

From the repository root, start with architecture and the affected module:

sh
dotnet test src/Tests/Architecture.Tests -c Release
dotnet test src/Tests/Catalog.Tests -c Release

The integration fixture uses WebApplicationFactory and Testcontainers, including PostgreSQL and RustFS. Start Docker before invoking it:

sh
dotnet test src/Tests/Integration.Tests -c Release --filter FullyQualifiedName~Catalog
dotnet test src/Tests/Integration.Middleware.Tests -c Release

The main fixture reads GN_TEST_POSTGRES_IMAGE when you need to verify a specific delivered database image; otherwise it uses its checked-in default. Keep experimental database-image changes isolated from existing development data.

For full backend verification, use dotnet test src/GhaylStack.slnx -c Release after preparing the required dependencies. For PDF cases, install the matching browser from the build as explained in PDF deployment. A missing container or browser is an environment failure to diagnose, not a reason to silently drop a test.

Run both web clients

Each client has its own lockfile, build, lint and browser suite:

sh
npm ci --prefix clients/admin
npm ci --prefix clients/dashboard
npm --prefix clients/admin run lint
npm --prefix clients/admin run build
npm --prefix clients/dashboard run lint
npm --prefix clients/dashboard run build
npm exec --prefix clients/admin -- playwright install chromium
npm --prefix clients/admin run test:e2e
npm --prefix clients/dashboard run test:e2e

The Playwright configuration starts its Vite server and mocks API routes. These suites exercise client behavior deterministically; they do not establish that the real API accepted the same request. Verify a real sign-in and the affected journey against a running API separately when the integration changes.

Add tests that expose the failure

For a write feature, assert the response and read the stored result back. Add invalid input, missing action permission, another tenant and organizational scope where relevant. For an outbox transaction, force rollback and inspect both business and outbox state. For translations, assert visible Arabic text and direction, not only that a resource file exists.

Reuse the existing fixture and authentication helpers. Generate unique names and clean up temporary tenant records, especially records with deliberately invalid connections. Shared integration state and order-dependent data can cause unrelated tests to fail later.

Record evidence precisely

Record commit, command, environment, result and any failed or skipped cases. Keep backend coverage distinct from frontend and device verification. A checked-in historical test total is evidence for that recorded run, not a guarantee about a different commit.

Use CI to understand the repository gates and artifacts. When a test fails, fix the cause and repeat the affected checks; do not report an entire suite as passing from a successful build alone.

Implementation references

View MarkdownBack to top

Search documentation

Use ↑ ↓ to move, Enter to open and Esc to close.