Skip to content

Add dump command-line provider validation tests - #11013

Merged
Amaury Levé (Evangelink) merged 1 commit into
mainfrom
evangelink-fix-issue-10966
Sep 4, 2026
Merged

Add dump command-line provider validation tests#11013
Amaury Levé (Evangelink) merged 1 commit into
mainfrom
evangelink-fix-issue-10966

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Expands unit coverage for the HangDump and CrashDump command-line providers, including timeout formats, dump types, boolean values, dependent and mutually exclusive options, arbitrary filenames, and runtime-specific fallback behavior.

Tests cover both .NET and .NET Framework paths, with 125 focused cases passing on net9.0 and net472.

Fixes #10966

Expand HangDump and CrashDump validation coverage for option values, dependencies, runtime-specific behavior, and fallback mappings.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 511a89f9-e9af-4770-be98-8148c6af9074
Copilot AI balanced review requested due to automatic review settings September 3, 2026 13:55
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🧵 Parallel-safety audit — PR #11013

Parallelization — assembly audited:

Test assembly Scope Workers Analyzer coverage
Microsoft.Testing.Extensions.UnitTests MethodLevel CPU count (Workers = 0) coverable once the parallel-safety analyzers ship (attribute-based [assembly: Parallelize])

Nothing audited here touches process-global state, shared filesystem paths, or [ResourceLock] / [DoNotParallelize] declarations. Nothing to flag for parallel-safety.

Both changed files (CrashDumpTests.cs, HangDumpTests.cs) only:

  • Convert existing single-value [TestMethod]s into [DataRow]-parameterized variants (same assertions, more values).
  • Add new self-contained validation tests (IsValid_If_CrashDumpFileName_Has_ArbitraryExtension, CrashDump_MainOptionOnly_IsValid, IsValid_If_HangDumpFileName_Has_ArbitraryExtension, IsInvalid_If_HangDumpType_Is_Triage_OnNetFramework, MapToSupportedDumpType_UnknownValue_FallsBackToFull) that only construct providers/options and assert on ValidationResult — no environment variables, current directory, culture, console state, or shared paths are touched.
  • Pre-existing tests elsewhere in CrashDumpTests.cs do write to disk (Directory.CreateDirectory/File.WriteAllText around lines 467–730), but each uses a Guid.NewGuid()-suffixed temp directory per test — already isolated and outside this PR's changed ranges — so no cross-test collision.

Findings: A (global-state) 0 · B (paths) 0 · C (declaration) 0 · D (over-serialization) 0 — by severity: Critical 0 · High 0 · Warning 0 · Info 0.

Advisory only — heuristic, non-blocking. Re-run with /parallel-audit. This audit answers "is it parallel-safe?"; for testability, smells, or flakiness see the detect-static-dependencies / test-smell-detection / test-anti-patterns analyses.

🤖 Automated content by GitHub Copilot. Generated by the Parallel-safety audit on PR (on open / sync) workflow. · auto · 43 AIC · ⌖ 4.37 AIC · ⊞ 24.8K · [◷]( · )

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

🤖 Automated review by GitHub Copilot. Generated by the Expert Code Review workflow. To request a follow-up action, reply by tagging @copilot directly.

Expert Review — 22-Dimension Assessment

Verdict: All clear ✅

This PR improves existing unit tests for CrashDumpCommandLineProvider and HangDumpCommandLineProvider by:

  1. Parameterizing hardcoded single-value tests into [DataRow]-driven tests covering more edge cases ("None", "TrUe", "", "-1", "auto", "30s", "2m").
  2. Replacing hardcoded string assertions with resource references (CrashDumpResources.CrashReportNotSupportedOnWindowsErrorMessage, ExtensionResources.MissingHangDumpMainOption) — more resilient to localization changes.
  3. Tightening assertionsstring.IsNullOrEmptyAssert.IsNull, and adding failure messages via Assert.IsTrue(result.IsValid, result.ErrorMessage).
  4. Adding new test cases for filename validation, main-option-only validation, Triage on .NET Framework, and MapToSupportedDumpType("Unknown") fallback.
  5. Fixing a typo in test name (IsInvValidIsInvalid).

Dimension Summary

# Dimension Result
1 Algorithmic Correctness ✅ N/A — test-only changes; all new assertions verified against source (MapToSupportedDumpType returns "Full" for unknown values, TimeSpanParser.TryParse supports "30s"/"2m" suffixes, resource strings exist and match)
2 Threading & Concurrency ✅ N/A
3 Security & IPC ✅ N/A
4 Public API & Binary Compat ✅ N/A — no API changes
5 Performance & Allocations ✅ N/A — test code only
6 Cross-TFM Compatibility #if !NETCOREAPP guard on the Triage/.NET Framework test is correct
7 Resource & IDisposable ✅ N/A
8 Defensive Coding ✅ N/A
9 Error Messages & Logging ✅ Resource-based assertions are an improvement
10 Naming & Conventions ✅ Typo fix (IsInvValidIsInvalid) is good
11 Documentation ✅ N/A
12 Localization ✅ N/A
13 Configuration & Options ✅ N/A
14 Test Quality ✅ Stronger parameterization, tighter assertions, better edge-case coverage
15 Async Patterns ConfigureAwait(false) used consistently
16 Code Duplication ✅ N/A
17 Backward Compatibility ✅ N/A — test-only
18 Build & Packaging ✅ N/A
19 Telemetry & Diagnostics ✅ N/A
20 Acceptance Test Conventions ✅ N/A — these are unit tests
21 Folder Hotspot Low risk — test/UnitTests/
22 Script & Tooling Hygiene ✅ N/A

No issues found. Clean improvement to test coverage and assertion quality.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The added cases are deterministic, correctly asserted, and consistent with provider behavior.

Review tier: Balanced
Findings: None

What changed in this PR

Expands MSTest unit coverage for HangDump and CrashDump command-line validation.

Changes:

  • Adds valid and invalid timeout, dump-type, and boolean cases.
  • Covers arbitrary filename extensions and main-option behavior.
  • Adds runtime-specific HangDump fallback validation.
File Description
HangDumpTests.cs Expands timeout, filename, and runtime fallback tests.
CrashDumpTests.cs Expands dump-type, boolean, filename, and main-option tests.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🧪 Expert test review — PR #11013

GradeTestMutationNotesHow to improve
A (90–100) mod CrashDumpTests.
IsInvalid_
If_CrashDumpType_
Has_IncorrectValue
2/2 killed Parameterized with invalid+None, asserts exact formatted error message.
A (90–100) mod CrashDumpTests.
IsValid_
If_CrashSequence_
Has_CorrectValue
7/7 killed Added `TrUe` case verifies case-insensitive boolean parsing, asserts null ErrorMessage.
A (90–100) mod CrashDumpTests.
IsInvalid_
If_CrashSequence_
Has_IncorrectValue
3/3 killed Covers empty string, near-miss `maybe`/`auto`; asserts exact resource message.
A (90–100) mod CrashDumpTests.
CrashReport_
OnWindows_
IsInvalid
1/1 killed Now asserts exact resource constant instead of a substring, tightening the check.
A (90–100) mod CrashDumpTests.
CrashReport_
WithCrashDump_
OnWindows_
IsInvalid
1/1 killed Same tightened resource-based assertion as the sibling test.
A (90–100) new CrashDumpTests.
IsValid_
If_CrashDumpFileName_
Has_ArbitraryExtension
1/1 killed Directly verifies the documented "no extension enforcement" behavior with a concrete value.
A (90–100) new CrashDumpTests.
CrashDump_
MainOptionOnly_
IsValid
1/1 killed Confirms `--crashdump` alone satisfies RequiresMainOption with no sub-option set.
A (90–100) mod HangDumpTests.
IsValid_
If_Timeout_Value_
Has_CorrectValue
3/3 killed Covers bare number, seconds, and minutes suffixes exercising TimeSpanParser branches.
A (90–100) mod HangDumpTests.
IsInvalid_
If_Timeout_Value_
Has_IncorrectValue
3/3 killed Covers invalid text, empty string, and negative number boundary cases.
A (90–100) mod HangDumpTests.
Missing_
HangDumpMainOption_
ShouldReturn_
IsInvalid
1/1 killed Switched to exact resource comparison, catching message-text regressions.
A (90–100) new HangDumpTests.
IsValid_
If_HangDumpFileName_
Has_ArbitraryExtension
1/1 killed Mirrors the CrashDump counterpart for the analogous file-name validation.
A (90–100) new HangDumpTests.
IsInvalid_
If_HangDumpType_
Is_Triage_
OnNetFramework
1/1 killed Correctly TFM-gated; asserts exact formatted error using the .NET Framework option set.
A (90–100) new HangDumpTests.
MapToSupportedDumpType_
UnknownValue_
FallsBackToFull
1/1 killed Exercises the unmapped-value fallback branch distinct from the existing Triage-specific test.

This advisory comment was generated automatically. Grades are heuristic
and informational — they do not block merging. Suggestions on the Files
changed tab can be applied with one click. Re-run with
/review-tests.

🤖 Automated content by GitHub Copilot. Generated by the Test Reviewer on PR (on open / sync) workflow. · auto · 98.5 AIC · ⌖ 2.63 AIC · ⊞ 16.9K · [◷]( · )

@Evangelink Amaury Levé (Evangelink) added the state/needs-review Awaiting review from the team. label Sep 3, 2026
@Evangelink
Amaury Levé (Evangelink) merged commit dbfdff5 into main Sep 4, 2026
38 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the evangelink-fix-issue-10966 branch September 4, 2026 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state/needs-review Awaiting review from the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[test-improver] Add unit tests for HangDump and CrashDump command-line providers

3 participants