SafeQueryAI Documentation

Privacy-first document Q&A with local RAG

View the Project on GitHub JYOshiro/SafeQueryAI

Testing

This page describes the current testing strategy for SafeQueryAI and how to run tests locally.

Test Strategy

SafeQueryAI uses a risk-focused testing approach:

Current Test Inventory

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:

Backend Testing

Tooling

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

Test Locations

backend.Tests/
  UnitTest1.cs
  Services/
    SessionServiceTests.cs
    FileStorageServiceTests.cs
    TextExtractionServiceTests.cs
    DocumentIndexingServiceTests.cs
    VectorStoreServiceTests.cs
    QuestionAnsweringServiceTests.cs

Run Backend Tests

dotnet test backend.Tests/

With coverage:

dotnet test backend.Tests/ --collect:"XPlat Code Coverage"

Frontend Testing

Tooling

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

Test Locations

frontend/src/test/
  App.test.tsx
  FileUploadPanel.test.tsx
  QuestionForm.test.tsx
  api.test.ts

Run Frontend Tests

cd frontend
npm test

Watch mode:

npm run test:watch

With coverage:

npm run test:coverage

Coverage and Quality Gates

Current baseline gates:

What Is Covered