Privacy-first document Q&A with local RAG
This page describes the current testing strategy for SafeQueryAI and how to run tests locally.
SafeQueryAI uses a risk-focused testing approach:
| Project | Framework | Test Count Basis |
|---|---|---|
| Backend | xUnit + Moq + FluentAssertions | [Fact] and [Theory] attributes |
| Frontend | Vitest + React Testing Library | it(...) cases |
Observed in repository at documentation update time:
Frontend test cases: 32
| Package | Version | Purpose |
|---|---|---|
| xunit | 2.5.3 | Test framework |
| Moq | 4.20.70 | Mocking dependencies |
| FluentAssertions | 6.12.0 | Readable assertions |
| coverlet.collector | 6.0.0 | Coverage collection |
| Microsoft.AspNetCore.Mvc.Testing | 8.0.0 | Integration-test host support |
backend.Tests/
UnitTest1.cs
Services/
SessionServiceTests.cs
FileStorageServiceTests.cs
TextExtractionServiceTests.cs
DocumentIndexingServiceTests.cs
VectorStoreServiceTests.cs
QuestionAnsweringServiceTests.cs
dotnet test backend.Tests/
With coverage:
dotnet test backend.Tests/ --collect:"XPlat Code Coverage"
| Package | Purpose |
|---|---|
| vitest | Test runner |
| @testing-library/react | Component rendering and querying |
| @testing-library/user-event | User interaction simulation |
| @testing-library/jest-dom | Extended DOM assertions |
| jsdom | Browser-like test environment |
| @vitest/coverage-v8 | Coverage output |
frontend/src/test/
App.test.tsx
FileUploadPanel.test.tsx
QuestionForm.test.tsx
api.test.ts
cd frontend
npm test
Watch mode:
npm run test:watch
With coverage:
npm run test:coverage
Current baseline gates:
Coverage reports should be generated for backend and frontend in CI.