mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2026-07-16 00:40:39 +00:00
6.0 KiB
6.0 KiB
Test TODO
Current suite status: broad parser, import, config JSON, compile, and runspace smoke coverage exists, but runtime behavior coverage is still very thin. Work from the top down; the first items are the highest-value gaps.
P0 - Highest Priority
-
Add config reference integrity tests.
- Verify every preset entry points to an existing tweak, feature, app, appx item, or supported action.
- Verify
appnavigation.jsonentries point to real tabs/panels and valid config groups. - Verify tweak, feature, DNS, appx, and theme entries include all fields used by the UI/rendering code.
- Verify all embedded script strings in
config/*.jsonparse as PowerShell when wrapped as scriptblocks.
-
Add XAML/control wiring tests.
- Load
xaml/inputXML.xamlas XML and verify expected named controls exist. - Verify controls referenced through
$sync["Name"],$sync.Name, or event handlers exist in XAML or are intentionally created dynamically. - Verify
Invoke-WPF*handler names used by buttons/tabs correspond to real functions. - Verify core tabs, search controls, install panels, tweak panels, and Win11 Creator controls are present.
- Load
-
Add mock-based tests for registry and service helpers.
- Cover
Set-WinUtilRegistryset/remove paths withMock New-Item,Mock Set-ItemProperty, andMock Remove-ItemProperty. - Cover
Set-WinUtilServicefor missing services, startup type changes, and no-op behavior. - Assert command parameters instead of touching the real registry or services.
- Cover
-
Add package selection and package manager tests.
- Cover
Get-WinUtilSelectedPackagesfor winget-only, choco-only, mixed,na, empty, duplicate, and missing package entries. - Cover
Test-WinUtilPackageManagerwith mockedGet-Command. - Cover
Install-WinUtilProgramWingetandInstall-WinUtilProgramChocowith mockedStart-Process, including install/uninstall arguments.
- Cover
-
Add runspace behavior tests beyond the smoke test.
- Cover no argument list, one named parameter, multiple named parameters, and scriptblock failures.
- Assert callers receive a single
IAsyncResult. - Verify failure output/errors can be retrieved by the owning PowerShell instance.
- Add focused tests for public functions that call
Invoke-WPFRunspacewithout executing their destructive inner work.
P1 - Important Workflow Coverage
-
Add tweak execution orchestration tests.
- Cover
Invoke-WinUtilTweakswith mockedInvoke-WinUtilScript,Set-WinUtilRegistry,Set-WinUtilService, andSet-WinUtilDNS. - Verify undo mode uses
OriginalValueandOriginalType. - Verify DNS provider and progress counters are passed through correctly.
- Cover
-
Add install/uninstall workflow tests.
- Cover
Invoke-WPFInstallandInvoke-WPFUnInstallwith mocked package sorting and mocked installers. - Verify empty selection prompts and exits.
- Verify process-running guard prevents a second install/uninstall.
- Verify taskbar/progress cleanup happens on success and error.
- Cover
-
Add update profile tests.
- Cover
Invoke-WPFUpdatesdisable,Invoke-WPFUpdatesdefault, andInvoke-WPFUpdatessecuritywith mocks for registry, services, scheduled tasks, and process calls. - Assert intended registry paths, values, service startup types, and scheduled task paths.
- Keep all tests non-mutating.
- Cover
-
Add AppX removal tests.
- Cover
Remove-WinUtilAPPXwith mockedGet-AppxPackageandRemove-AppxPackage. - Cover
Invoke-WPFAppxRemovalselection behavior and runspace parameter passing. - Verify empty selection is handled without removal calls.
- Cover
-
Add UI selection/state helper tests.
- Cover
Update-WinUtilSelections,Reset-WPFCheckBoxes,Invoke-WPFSelectedCheckboxesUpdate, andInvoke-WPFToggleAllCategories. - Use small fake checkbox/control objects instead of WPF windows where possible.
- Verify selected apps, tweaks, toggles, appx, and features stay in sync with checkbox state.
- Cover
P2 - Domain-Specific Coverage
-
Expand Win11 Creator tests.
- Test edition name to edition ID mapping.
- Test
ei.cfgandPID.txtgeneration/removal behavior in a temp directory. - Test autounattend conversion preserves required nodes and removes unsupported product key paths.
- Test driver injection branching with mocked DISM commands.
- Test ISO export fallback when
oscdimg.exeis missing and winget install fails.
-
Add preferences/theme tests.
- Cover
Set-Preferencesloading, saving, old preference cleanup, and defaults. - Cover theme resource updates without opening the full GUI.
- Verify theme config contains required brushes/colors used by the theme code.
- Cover
-
Add search/filter tests.
- Cover
Find-AppsByNameOrDescriptionandFind-TweaksByNameOrDescriptionwith fake UI item trees. - Verify empty search restores visibility.
- Verify category labels and panels hide/show correctly.
- Verify description and display-name matches both work.
- Cover
-
Add compile contract tests.
- Verify compiled config key transformation for
applications.jsonaddsWPFInstallprefixes. - Verify source ordering in
winutil.ps1: start script, functions, configs, XAML, autounattend XML, main script. - Verify generated build date placeholder is replaced.
- Verify generated script does not contain unresolved
#{replaceme}.
- Verify compiled config key transformation for
P3 - Nice To Have
- Add Script Analyzer as a failing CI gate once existing findings are triaged.
- Add docs generation/link checks for
docs/content. - Add coverage reporting in CI as informational output.
- Add a lightweight test helper module for fake
$sync, fake WPF controls, and common mocks. - Add regression tests whenever a production bug is fixed.
Guardrails
- Tests must not mutate the real registry, services, scheduled tasks, package managers, AppX packages, USB disks, ISOs, or user profile state.
- Prefer Pester mocks and temp directories for system-facing code.
- Keep generated
winutil.ps1ignored and never commit it. - Run the full gate before marking test work complete:
Invoke-Pester -Path 'pester/*.Tests.ps1' -Output Detailed -CI