Add round-trip deserialization test for non-default AppSettings values#41
Open
anagnorisis2peripeteia wants to merge 1 commit into
Open
Conversation
The XML string-proxy setters in AppSettingsDTO (bool/int/enum TryParse -> assign) were unasserted: mutation testing showed that negating the parse guard or deleting the assignment both survived, because the existing fixture only used default values. This adds a round-trip test that deserializes non-default values and asserts each typed property, so a setter that fails to assign is now caught. Part of hbashton#37
Contributor
Author
|
Before/after behavioral evidence for this coverage addition — mutation testing (Stryker.NET) of the file under test,
The new test kills 36 previously-surviving mutants — the string-proxy setters ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While going through the settings-code coverage gaps in #37, I noticed the
AppSettingsDTOXML round-trip only exercises these proxy setters with their default values.CheckSettingsReaddeserializes the fixture but only assertsLastChecked, so a string-proxy setter that silently failed to assign would still go unnoticed.This adds one test,
CheckSettingsDeserializeNonDefaultValues, that deserializes a<Profile>with non-default values for the…Stringproxy settings (the ones that parse viabool/int/Enum.TryParseand assign the typed property) and asserts each typed property came through. Because every value differs from its default, a setter that drops the assignment—or inverts theTryParseguard—now yields the wrong value and fails the assertion.It covers about 20 settings, including
DisconnectBTAtStop,SwipeProfiles,QuickCharge,AppIcon(TrayIconChoice.Colored),AppTheme(AppThemeChoice.Dark), and theDeviceOptions.*SupportSettings.Enabledflags. I deliberately skippedUseExclusiveMode,StartMinimized, andMinimizeToTaskbar, which go throughXmlDataUtilities.StrToBool; those read cleanest as a small follow-up.Before/after proof:
For a direct red/green check, I removed the same representative assignment (
DisconnectBTAtStop = temp) in isolated base and HEAD worktrees and ran this exact command on both:ba4bdcb7with the injected fault: exit 0; no matching regression test exists.4f932abfwith the same fault: exit 1; the new test fails onExpected:<True>. Actual:<False>.The full sanitized logs and machine-readable proof manifest are attached. This is test-only with no renderable UI change, so terminal and mutation evidence are the relevant proof rather than screenshots.
Local review history: round 1 https://gist.github.com/anagnorisis2peripeteia/29e14a33c013c9f7da6fcb10e4813d26 · round 2 https://gist.github.com/anagnorisis2peripeteia/ab31cc0bb9a970a81591a2f06399769c
Proof manifest
Before / After (same command, same machine)
DisconnectBTAtStopassignment)CheckSettingsDeserializeNonDefaultValuesfails — fault caughtFault-injection proof (test-only PR): neutered the
DisconnectBTAtStopStringsetter's assignment identically on base and this branch, ran the same focused suite on both. Base + fault: suite passes (fault missed). This branch + fault:CheckSettingsDeserializeNonDefaultValuesfails (fault caught). Clean branch: suite passes. Mutation delta onAppSettingsDTO.cs: 2.2% -> 21.9% (36 more mutants killed), posted above.Manifest + raw run outputs: https://gist.github.com/anagnorisis2peripeteia/4b9eb34a1e5123d9e791d1bc2dcd1f9b