-
Notifications
You must be signed in to change notification settings - Fork 4
14 testing
The test project, conventions, coverage, and how to run the tests. Related: ManualTests.md (manual checklist) · 02 — Projects & Solution
-
SimpleLauncher.Tests— xUnit (net10.0-windows), referencesSimpleLauncher(and transitivelySimpleLauncher.Core);InternalsVisibleTogives access to internal members. - Frameworks: xUnit, Moq 4.20.72, Serilog
ILoggermocks viaNoOpLogger; Meziantou analyzer enabled. -
150 test files (~2000 tests). Parallelization is disabled (
AssemblyInfo.cs:CollectionBehavior(DisableTestParallelization = true)) because several tests share static/WPF state.
| Helper | Purpose |
|---|---|
NoOpLogger |
Serilog ILogger that discards everything |
NoOpMessageBoxLibraryService |
Stub for IMessageBoxLibraryService (large; all methods) |
NoOpCredentialProtector |
Plaintext credential protector for settings tests |
NoOpGetListOfFiles / NoOpResourceProvider
|
Other no-op stubs |
ServiceProviderMock |
Installs a fake IServiceProvider where static access is required |
ProjectPathHelper |
Resolves repo-relative paths for tests (e.g. parameters.md) |
StaApartment |
Runs test actions on an STA thread (with optional WPF Application) for headless UI tests |
Unit tests cover the core logic layer: settings & system manager persistence, favorites, play history, game scanner core, file finder, search orchestrator, launch strategies (default, DOSBox, Commander Genius, CHD/CUE, PBP, XISO, ZIP), mount-strategy matching, Core emulator config-injection services, models/DTOs, path/URL/sanitizer/pagination/filter helpers, RetroAchievements manager/matcher/hasher, Steam VDF parser, update-check logic, API connectivity, converters' strategy classes — plus the batch added in 5.6.x: parameter resolver API service, system.xml writer + emulator XML helpers, game file watcher, loading overlay, UI reset, status bar, menu check-marks, credential protector (DPAPI), system-selection ViewModel, default-folder/temp/missing-file services.
What is not covered (windows, Views, ViewModels, live file operations, store scanners, gamepad/audio, RA API layer, per-emulator launch handlers) — see ManualTests.md for the full manual checklist.
# build + run everything
dotnet test SimpleLauncher.Tests/SimpleLauncher.Tests.csproj
# run a single class or feature
dotnet test SimpleLauncher.Tests/SimpleLauncher.Tests.csproj \
--filter "FullyQualifiedName~GameFileWatcherServiceTests"
# run everything except the slow network/integration tests
dotnet test SimpleLauncher.Tests/SimpleLauncher.Tests.csproj \
--filter "FullyQualifiedName!~IntegrationTests&FullyQualifiedName!~ApiConnectivity&FullyQualifiedName!~StatsApiConnection&FullyQualifiedName!~UpdateSimulation&FullyQualifiedName!~RetroAchievementsManager"⚠ Known slow test:
UrlValidationTests.ParametersMdAllUrlsAreReachablepings every URL inparameters.mdover the network without a timeout — it can take 15+ minutes or hang when a URL is unreachable. Exclude it (or fix it with aCancellationTokentimeout) for local runs.
- One test file per production class:
XxxTests.cs; test class name matches the target. -
using Xunit;explicitly (no global using). - Mock interfaces with Moq; use real temp directories for filesystem services (
Path.GetTempPath()+ GUID, cleanup inDispose). - WPF-touching tests run inside
StaApartment.Run/RunAsync(seeLoadingOverlayServiceTests,MenuCheckMarkServiceTests,UiResetServiceTests). - Timing-based tests (watcher debounce) keep delays small and use
TaskCompletionSource+WaitAsynctimeouts. - String assertions use
StringComparer.Ordinaloverloads (Meziantou MA0002/MA0074).
- Home
- 01 Overview
- 02 Projects And Solution
- 03 Quickstart
- 04 Architecture
- 05 Configuration
- 06 Systems And Launch
- 07 Core Services
- 08 Ui Layer
- 09 Retroachievements
- 10 Game Scanning
- 11 Bundled Tools
- 12 Data Formats
- 13 Logging And Debug
- 14 Testing
- 15 Development
- 16 Updater
- 17 Release Notes
- 18 Emulator Parameters
- Manual Tests
- Parameters