18 Testing
Emily edited this page 2026-11-11 10:36:59 +01:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Testing

Commands

flutter analyze
flutter test --concurrency=1

--concurrency=1 is recommended for the full suite. Running all widget tests in parallel can exhaust the test runner's resources and hang on some machines.

At release 2.12.2, the suite contains 351 passing tests Localization is covered twice: test/localization_test.dart checks that each language renders its own strings, that placeholders survive translation and that the language setting persists, and test/localization_layout_test.dart renders home, hub and settings in all four non-English languages on a 360 px phone so a longer translation cannot overflow. and flutter analyze reports no issues.

What is covered

Area Examples
Sudoku Generation, uniqueness, solver, notes, undo/redo, mistakes, hints, pause, completion
Killer Sudoku Cage coverage, sums, non-repeating digits, uniqueness, saves
Card games Legal moves, undo, win/loss detection, draw rules, TriPeaks chains
Mahjong Layout, free-tile rules, solvable deals, hints
Minesweeper First-click safety, flood reveal, flags, chording, win/loss
Chess Legal moves, castling, en passant, promotion, checkmate, stalemate, draws, AI
Online chess Parsing, perspective, challenge/match flows
Leaderboard Ranking, best-score replacement, local fallback, upload paths
Accounts Register, login, rename, e-mail, password reset, server connection
UI/layout Phone portrait/landscape, tablets, desktop sizes, settings, dialogs
Save backups Export/import, upload, restore, error paths, backup hook
Presence Detail/state formatting, signatures, settings persistence

Test layout

test/
  account_screen_test.dart
  account_service_test.dart
  app_settings_test.dart
  cards_test.dart
  chess_ai_test.dart
  chess_engine_test.dart
  chess_online_test.dart
  chess_screen_test.dart
  competitive_leaderboard_test.dart
  game_controller_test.dart
  game_presence_test.dart
  game_screen_test.dart
  game_screens_test.dart
  killer_sudoku_test.dart
  leaderboard_screen_test.dart
  leaderboard_test.dart
  mahjong_test.dart
  minesweeper_test.dart
  save_backup_test.dart
  solitaire_controller_test.dart
  sudoku_solver_test.dart
  update_service_test.dart
  web_footer_test.dart
  widget_test.dart

Widget tests use MockClient for HTTP and SharedPreferences.setMockInitialValues for storage. The test suite does not need a running backend.

Layout coverage

Game screens and settings are exercised at sizes including:

  • 320×568 — small phone portrait.
  • 390×844 — modern phone portrait.
  • 568×320 — small phone landscape.
  • 844×390 — large phone landscape.
  • 768×1024 — iPad portrait.
  • 1024×1366 — iPad Pro portrait.
  • 1200×800 and 1366×1024 — desktop windows.

These tests catch overflow, unreachable controls and compact-mode regressions.

Backend tests

The backend has its own test suite. See the backend wiki testing page.

cd ../universal_gaming_backend
npm test
npm audit --omit=dev

Release gate

Before a release:

  1. flutter analyze
  2. flutter test --concurrency=1
  3. Build every available target.
  4. Smoke-test the web build and account server.
  5. Generate and verify SHA256SUMS.txt.