Skip to content

Latest commit

 

History

History
505 lines (393 loc) · 152 KB

TESTING_GUIDE.md

File metadata and controls

505 lines (393 loc) · 152 KB

Testing Guide(English)

This document centralizes the project's testing strategy, execution commands, and practical guardrails for extending tests safely.

Related documents:

Test Stack

Package versions change over time. Treat FolderDiffIL4DotNet.Tests/FolderDiffIL4DotNet.Tests.csproj, .config/dotnet-tools.json, and package.json as the source of truth for current versions.

Current Test Scope Map

Use the commands in Run Tests Locally to inspect the current totals, pass/fail counts, and skipped tests in your environment. This guide intentionally focuses on scope and meaning rather than run-specific counts.

Version metadata regression coverage verifies that SystemInfo separates the three-part public SemVer from the detailed diagnostic build version, --version and --doctor use the intended form, and README/package/sample metadata stays aligned with version.json.

Area Main test classes What is validated
Entry and configuration ProgramTests, ProgramRunnerTests, CliOptionsTests, ConfigServiceTests, ConfigSettingsTests Main exit codes, typed ProgramRunner exit-code mapping for invalid arguments vs. config failures, phase ordering around validation vs. config loading, minimal end-to-end execution, CLI argument parsing via CliParser (null/empty/positional-only args, every documented flag plus hidden spinner Easter-egg compatibility flags, unknown flag detection, combined flags, --config/--threads missing-value errors, spinner last-wins behavior, multiple-spinner detection (MultipleSpinnersDetected)), code-defined config defaults (verified via ConfigSettings.Default* named constants) and override behavior, SHA256/timestamp warning console and report output, reflection-backed verification of internal IL cache defaults wired by ProgramRunner, completion summary chart output (bar rendering for each file category, zero-total skip, label alignment); JSON syntax error reporting: trailing comma in object ({"Key":"v",}), trailing comma in array (["a","b",]), and multiline JSON with line-number verification in the InvalidDataException message, line N, position N pattern verification, trailing-comma hint appended to all JSON parse errors, custom config path FileNotFoundException with path in message; preflight write-permission check with fail-fast on IOException (no silent swallowing) and cause-specific logging via ILoggerService; --help text "Tip:" section promoting --print-config; hidden spinner Easter-egg flags remain parseable but are absent from --help output and current user-facing documentation; stderr --print-config hint on configuration error (exit code 3), --wizard interactive mode redirected-stdin rejection (exit code 2 with error message), --clear-cache interactive wizard redirected-stdin rejection (exit code 2 with error message), --clear-cache option in --help output, --open-reports/--open-config/--open-logs early-exit with folder path output, --output/--config override integration, default-target order (Reports → application data root/config directory → Logs) when multiple open flags are combined, short-circuit on first/second-launch failure, and launcher-failure error reporting with the resolved target path, CheckDiskSpaceOrThrow empty-path skip, CheckReportsParentWritableOrThrow empty-parent skip and probe-file cleanup verification, --help output contains open-folder options, IL cache helper methods (FilterCacheFilesByTool tool-name matching with short-filename skip, FilterCacheFilesByToolLabel exact version matching via sanitize round-trip, ExtractDistinctToolLabels distinct sorted label extraction from cache filenames with deduplication and short-filename skip, UnsanitizeToolLabel version-pattern reversal and no-version fallback, SanitizeForCacheMatch colon/parenthesis replacement, sanitize→unsanitize round-trip identity), custom output directory via --output (path override, missing value error, default null), GetReportsFolderAbsolutePath with custom/null/empty output directory; NormalizeDragDropPath drag-and-drop path normalization (double/single quotes, file:///file:/// URI prefixes, backslash-escaped spaces, percent-encoded characters including Japanese, combined formats, empty input, malformed percent-encoding), unresolved LocalApplicationData classification for normal runs and --open-reports, help-text wording for the active reports root, and resolved-path stderr diagnostics for invalid user-local vs. bundled fallback config JSON
Core diff flow FolderDiffExecutionStrategyTests, FolderDiffServiceTests, FolderDiffServiceUnitTests, FileDiffServiceTests, FileDiffServiceUnitTests, FileDiffResultListsTests, DiffExecutionContextTests Discovery filtering, auto-parallelism policy (I/O-bound ProcessorCount × 2 for local paths, network-capped for network shares), classification (Unchanged/Added/Removed/Modified), diff detail labels, timestamp-regression detection only for modified files (unchanged files with reversed timestamps produce no warning), reset behavior, case-insensitive extension handling, propagated text-diff fallback behavior, permission/I/O failure handling, expected-vs-unexpected exception logging/rethrow behavior including stage-aware FileDiffService diagnostics (RelativePath, Stage, SkipIL, MaxParallel), large-batch classification without real disk I/O, IL-precompute batching for large trees, memory-budget-based throttling of large-text chunk comparison, multi-megabyte real-file text comparison, symlink-backed file classification, per-file hash/IL/text error handling without real disk, symlink-loop IOException during enumeration (logged and rethrown), FileNotFoundException during per-file comparison classified as Removed with a warning (both sequential and parallel modes), DiffSummaryStatistics/SummaryStatistics snapshot correctness, completion message routed through ILoggerService instead of direct Console.WriteLine, CancellationToken propagation through diff pipeline (pre-cancelled token throws OperationCanceledException), best-effort semantic analysis CA1031 fallback (warning logged but diff result unaffected when AssemblyMethodAnalyzer.Analyze fails on non-existent paths), FolderDiffExecutionStrategy.CountDotNetAssemblyCandidates empty-input behavior, duplicate-path suppression, managed-assembly-only counting, per-file progress reporting to 100%, DiffExecutionContext constructor null-parameter validation (ArgumentNullException for each of oldFolderAbsolutePath/newFolderAbsolutePath/reportsFolderAbsolutePath), IL output sub-path derivation from reports folder, and network-share flag preservation
Dependency analysis DepsJsonAnalyzerTests, NuGetVersionRangeTests, NuGetVulnerabilityServiceTests Structured dependency change analysis for .deps.json files: added/removed/updated package detection, importance classification by semver (major=High, minor=Medium, patch=Low), case-insensitive package names, invalid JSON / missing file graceful fallback (returns null), DependencyChangeSummary max importance and sort-by-importance ordering, realistic .deps.json structure parsing with runtime/compile targets; NuGet version range parsing and containment checks (exact [x.y.z], open/closed intervals [min, max), pre-release suffix stripping, four-part versions, edge cases); NuGet V3 vulnerability API integration (index page URL parsing, vulnerability page parsing, DepsJsonAnalyzer.Analyze missing-file onError callback invocation, successful-analysis onError non-invocation, invalid targets section graceful handling, per-package vulnerability checking with old/new version detection, resolved vs. newly-introduced vulnerabilities, severity label mapping, DependencyChangeSummary vulnerability count properties, retry after transient load failure, OperationCanceledException propagation, per-page warning logs that retain exception-type context, vulnerability index fetch failure logging with index URL context, outer best-effort failure logging with entry/package counts, index fetch OperationCanceledException propagation)
IL/disassembler behavior ILOutputServiceTests, ILBlockParserTests, DotNetDisassembleServiceTests, DisassemblerBlacklistTests, DisassemblerHelperTests, DotNetDisassemblerCacheTests, DotNetDetectorTests, AssemblyMethodAnalyzerTests, AssemblySemanticChangesSummaryTests, ChangeImportanceClassifierTests, ChangeTagClassifierTests, CompilerGeneratedResolverTests Same-disassembler pairing, fallback behavior, block-aware order-independent IL comparison (BlockAwareSequenceEqual) with method reordering tolerance, IL block parsing (ILBlockParser.ParseBlocks) for preamble/method/class/nested-brace handling, blacklist logic (including TTL-boundary expiry: entry removed and tool retried after the 10-minute blacklist window), independent per-tool blacklist state, null/whitespace safety for RegisterFailure/ResetFailure (explicit branch coverage for the null guard true-branch), reset of non-existent command, concurrent RegisterFailure with 32 threads, concurrent TTL-expiry race with no exceptions, detection and command handling, failure-vs-non-.NET detection semantics; ResolveExecutablePath branch coverage for relative paths containing directory separators (found and not found), whitespace-only PATH environment variable, PATH entries that are empty strings, and commands found via PATH search; Windows-only EnumerateExecutableNames tests verifying no duplicate .exe/.cmd/.bat extension variants when the command already carries those suffixes; ProbeAllCandidates availability probing returns non-empty list with unique tool names including both dotnet-ildasm and ilspycmd; shared path-shape diagnostics now keep warning formatting alive even when invalid path characters appear in disassembler command strings; BuildInstallSuggestion OS-specific install command presence, bilingual text with --skip-il tip, Windows/macOS/Linux PATH guidance; assembly semantic analysis detects Modified entries for method access/modifier changes and property/field type/access/modifier changes; ChangeImportanceClassifier correctly classifies all importance levels (High for public/protected removal and access narrowing, Medium for public addition and internal removal, Low for body-only and private additions), WithClassifiedImportance preserves all fields; AssemblySemanticChangesSummary importance counts, max importance, and entries sorted by importance; CA1031 catch-all fallback paths for corrupt/truncated/empty PE files (returns null instead of throwing), asymmetric valid-vs-corrupt assembly pair; streaming IL comparison (StreamingFilteredSequenceEqual) with built-in MVID normalization, configured normalization strings, configured ignore strings, empty inputs, length mismatch, all-excluded equality, and behavioral equivalence with legacy SplitAndFilterIlLines + SequenceEqual; FilterIlLines line filtering with and without exclusions; SplitToLines line splitting for LF, CRLF, empty, null, and trailing-newline inputs; ChangeTagClassifier heuristic pattern detection (Extract same-type modified+private added, Inline reverse, Move cross-type, Rename same-type different name, Signature/Access/BodyEdit arrow detection, DepUpdate dependency-only changes), FormatTags comma-separated formatting, GetLabel label mapping, edge cases (public method not consumed by Extract, same-type not triggering Move); ValidateILIgnoreContainingStrings safety validation (null input, empty input, all-safe strings, short string warning, mixed lengths, exact minimum length boundary); compiler-generated name resolution (CompilerGeneratedResolver): async state machine, display class, lambda method, backing field, local function, record clone/synthesized member annotation and detection; SimpleSignatureTypeProvider.GetGenericInstantiation arity suffix stripping for deeply nested generics, GetTypeFromReference nested type resolution via ResolutionScope, runtime assembly generic signature verification (no backtick-arity in generic instantiations); Analyze optional onError callback invocation on failure and non-invocation on success
Real disassembler E2E RealDisassemblerE2ETests Builds the same small class library twice with Deterministic=false, confirms the rebuilt DLLs differ by SHA256, and verifies that dotnet-ildasm still classifies them as ILMatch after MVID normalization
Real IL output corpus ILOutputCorpusTests, Fixtures/ILCorpus Pins real output from dotnet-ildasm 0.12.2.0 and ilspycmd 9.1.0.7988, the fallback baseline for inspecting assemblies targeting .NET 8/9/10, for one signed sample assembly covering ordinary and compiler-generated types, nested methods, generics, async/iterator/lambda shapes, properties/events/fields, AssemblyRefs, and reproducible COM interop metadata; validates corpus completeness, each tool's actual syntax, and that every built-in rule is applied regardless of disassembler provenance
Folder diff → report E2E FolderDiffReportE2ETests Full pipeline integration: folder diff → Markdown/HTML/audit log generation → output verification; all-unchanged scenario (zero-change summary); subdirectory relative path preservation in all report types; parallel vs sequential classification consistency; audit log SHA256 hashes referencing generated reports (64-char hex, distinct per file); HTML interactive elements (checkboxes, autoSave, collectState, applyFilters, CSP, SHA256 integrity code); inline diff content for modified text files
Caching ILCacheTests, ILDiskCacheTests, ILCachePrefetcherTests, ILCacheConcurrencyTests, ILCacheDiskFailureTests memory/disk cache semantics, same-key updates at capacity, eviction coordination, keying behavior, concurrent Set/Get under memory and disk modes, LRU eviction under contention, TTL expiry races, disk I/O failure simulation (read-only directory, corrupted files, mid-operation directory deletion, zero-byte cache file, concurrent writes to invalid path), direct disk-layer guard/log coverage for invalid cache-directory initialization, blank cache keys, overlong cache-key path failures, and quota-trim context logging, disk quota enforcement (MaxDiskFileCount trimming, size limit trimming), rapid writes to read-only directory with memory fallback, IL-cache prefetch argument validation (null/empty input, invalid maxParallel), cache-disabled and null-cache prefetch handling, cache-hit counter tracking, constructor null-guard checks
Edge cases DisassemblerBlacklistTtlRecoveryTests, LargeFileComparisonTests, SymlinkAndCircularDirectoryTests, FolderDiffConcurrencyStressTests TTL recovery cycles and concurrent register/check for DisassemblerBlacklist, 4 MiB file chunk-parallel comparison, symlink loop/dangling handling, 500-file parallel classification determinism, simulated latency stress test
Golden file snapshots GoldenFileSnapshotTests, GoldenReportSampleConsistencyTests GoldenFileSnapshotTests performs structural validation of doc/samples/diff_report.md (section existence, section ordering, section-count-vs-summary consistency, disassembler availability table format, importance levels in modified files, legend tables, IL cache stats metrics, header metadata fields, warning types), report generation determinism tests (generate twice from same data, verify identical output for Markdown/HTML), and structural verification of generated reports including metadata, file categories, diff detail labels, and importance levels. GoldenReportSampleConsistencyTests separately verifies that the checked-in Markdown and HTML normalization tables match the complete ordered creator-default profile plus the sample-only overlap-warning value.
Reporting/logging/progress ReportGenerateServiceTests, HtmlReportGenerateServiceTests, AuditLogGenerateServiceTests, SbomGenerateServiceTests, LoggerServiceTests, ProgressReportServiceTests, TestLoggerTests, ReviewChecklistLoaderTests report sections/summary formatting, report-only warning responsibility, HTML report file creation, W3C Trace Context (traceId 32-hex-char after Initialize(), spanId per-entry) in JSON log format, interactive checkbox/input element presence, toggle-all header checkbox in semantic-changes detail table (.cb-all-detail class), main table toggle-all header checkbox (.cb-all class with data-section, toggleAllInSection handler, no id attribute), state module virtual-scroll awareness (table.__vs, rowData[i].cbChecked, table.vs-active, rd.cbId), init module header checkbox exclusion from autoSave listeners (.cb-all, .cb-all-detail), section colour coding, localStorage sentinel, ShouldGenerateHtmlReport=false skip, HTML encoding of special characters (backtick/non-ASCII via WebUtility.HtmlEncode, Unicode/mixed-script XSS prevention, normal text passthrough), Content-Security-Policy meta tag presence and ordering (between charset and viewport), inline diff summary #N numbering aligned with the leftmost table column, log output behavior including cleanup warnings that retain directory/retention context, shared log-file/date formats, progress reporting lifecycle plus fixed-width ETA rendering/clamping/placeholder behavior for inline and redirected progress output, Unicode filenames (Japanese/Umlaut/Chinese) in Modified and Unchanged sections, large-file-count (10,500) summary statistics correctness, InlineDiffMaxDiffLines suppression (diff computed first; skipped when diff output line count exceeds threshold), legend table format, stat-table column headers and visible borders, InlineDiffMaxEditDistance code tag, diff-row background color, clipboard copy button, row hover highlight, table sort order (Unchanged: SHA256Match -> ILMatch -> TextMatch then path; Modified/Warnings: TextMismatch -> ILMismatch -> SHA256Mismatch then path), SHA256Mismatch warning detail table (file listing, alphabetical sort, table ordering before Timestamps Regressed, interleaved layout with warning messages immediately followed by detail tables), semantic summary caveat note presence and CSS styling in HTML report, dark mode CSS custom properties (prefers-color-scheme) and theme-aware utility classes (.imp-high, .imp-medium, .status-available, .status-unavailable, .vuln-new, .vuln-resolved, .warn-danger, .warn-caution), Assembly Semantic Changes section excluded from Markdown report, structured JSON audit log generation (audit_log.json) with metadata/summary/file-entries/SHA256 integrity hashes, ShouldGenerateAuditLog=false skip, tamper detection via different report content producing different hashes, empty result handling, constructor null checks, reviewed HTML SHA256 integrity verification code presence (Web Crypto API crypto.subtle.digest, companion .sha256 file, __reviewedSha256__/__finalSha256__ sentinels, pre-created file input with accept='.sha256', and verifyIntegrity self-verification function), Access/Modifiers <code> wrapping with arrow-aware formatting (CodeWrapArrow), disassembler availability table in Markdown/HTML report header (shown when probe results exist, omitted when null), disassemblerAvailability array in audit log JSON, interactive filter zone presence (diff detail/importance/unchecked-only/search controls), responsive controls layout that keeps the progress summary above wrapped action buttons on narrow windows, filter zone placement outside <!--CTRL-->...<!--/CTRL--> markers so reviewed HTML keeps filtering, data-section/data-importance attributes on file rows, filter-hidden/filter-hidden-parent CSS rules, applyFilters()/resetFilters() JS functions, __filterIds__ exclusion from collectState(), downloadReviewed() filter-hidden class clearing before outerHTML capture, downloadReviewed() live page filter state restoration via applyFilters() after outerHTML capture, Excel-compatible HTML export function presence (downloadExcelCompatibleHtml, buildExcelRow), Excel export button placement outside <!--CTRL--> markers, theme toggle button presence and placement outside <!--CTRL--> markers (cycleTheme, initTheme), completion celebration animation CSS/JS presence (celebrate-container, celebrate-rise, celebrateCompletion, __celebrationFired__, prefers-reduced-motion respect), phase-based progress numbering (BeginPhase label formatting [current/total], phase counter increment, progress reset on phase transition, per-phase elapsed time logging, FormatPhaseElapsed formatting, TotalPhases validation, dispose-time final phase logging), IL syntax highlighting CSS classes (.hl-directive, .hl-keyword, .hl-type, .hl-string, .hl-comment, .hl-label), IL highlight color variables (--color-hl-*) in light and dark themes, highlight JS module function presence (highlightILCell, highlightILDiff, highlightAllILDiffs, __ilPatterns__), keyboard shortcut JS module function presence (moveBy, toggleCheck, toggleHelp, isTyping, __kbEscHandled__), keyboard focus and help overlay CSS styles (tr.kb-focus, .kb-help, .kb-help-visible, .kb-help-hidden, backdrop-filter), keyboard help overlay HTML presence (id="kb-help", Keyboard Shortcuts, <kbd> elements), storage bar elements presence (storage-group, storage-bar, storage-fill, storage-text), "Free up review storage" button with tooltip (btn-tooltip-wrap, btn-tooltip, clearOldReviewStates), updateStorageUsage/clearOldReviewStates JS function presence, setupLazyIntersectionObserver JS function and IntersectionObserver presence, chunked Excel export functions (downloadExcelChunked, finalizeExcelDownload, buildExcelFramework, downloadExcelImmediate), aligned log-level prefix width ([INF], [WRN], [ERR]) assertions, TestLogger concurrent capture / callback integrity under parallel logging, and review checklist loader warning behavior including malformed LocalApplicationData overrides falling back to an empty optional checklist instead of aborting report generation
Core utility layer FileComparerTests, FileSystemUtilityTests, PathValidatorTests, ProcessHelperTests, SystemInfoTests, TextSanitizerTests, TextDifferTests, EncodingDetectorTests, ConsoleRenderCoordinatorTests, ConsoleBannerTests hashing/text compare, shared report-timestamp formatting, path/network detection (including //-prefixed forward-slash UNC and IP-based UNC paths), command tokenization, file-name/path sanitization, computer name and app version retrieval (SystemInfo), Myers diff algorithm correctness (identical/empty/added/removed lines, context lines, hunk headers, edit-distance cap, output-line truncation, large-file small-diff efficiency), file encoding auto-detection (UTF-8 with/without BOM, UTF-16 LE/BE, Shift_JIS, ASCII, empty file, round-trip decoding of Japanese text), console render coordinator thread-safety (RenderSyncRoot, spinner throttling, MarkProgressRendered timing), time-based greeting message correctness (all 24 hours covered, no empty strings, meal-time "Leave the diff to me" slots, coffee-break message consistency), the reusable helper contract now housed in FolderDiffIL4DotNet.Core, TryGetProcessOutputAsync non-zero exit code null-return and valid command output and null-args safety, SystemInfo.GetComputerName and GetAppVersion consecutive-call determinism
HTML report JavaScript diff_report.test.js, diff_report_extended.test.js (Jest/jsdom) formatTs date formatting, collectState checkbox/text/textarea collection with filter-ID exclusion, autoSave localStorage persistence and status display, applyFilters diff-detail/importance/unchecked-only/search filtering with associated diff-row hiding (including SHA256Match/ILMatch/TextMatch/TextMismatch diff-detail filters and combined diff+importance filtering), resetFilters default state restoration, decodeDiffHtml base64-UTF8 decoding (including multibyte), reviewed-state encodeEmbeddedState / decodeEmbeddedState Base64 round-trip for UTF-8 and script-breaking text, collapseAll details-element folding, clearAll input reset with confirm guard, DOMContentLoaded state restore from __savedState__ and localStorage, reviewed-mode read-only enforcement, verifyIntegrity null-guard alert, setupLazyDiff lazy decode/insert on toggle with no-duplicate-decode guard, setupLazySection lazy section decode with save-event wiring, forceDecodeLazySections batch decode without toggle, updateProgress review-count aggregation (including lazy sections) and corrupted-localStorage tolerance, esc HTML escaping (XSS prevention), readSavedStateFromStorage edge cases (invalid JSON, fallback, array), copyPath clipboard interaction, toggleDiffView side-by-side mode (del+add pairing, standalone del/add, hunk headers, unified restore), buildExcelRow cell extraction and short-row guard, keyboard navigation (Escape closes details), highlightILCell directive/label/type/keyword highlighting with prefix preservation and skip-already-highlighted/empty guards, highlightILDiff ILMismatch targeting and TextMismatch skipping, keyboard navigation (j/k file row focus, x checkbox toggle, help overlay auto-show/auto-hide, Esc text input blur with __kbEscHandled__ coordination), getStoredTheme localStorage read/error handling, highlightAllILDiffs bulk IL highlight with ILMismatch/SHA256Mismatch discrimination, wrapInputWithClear container wrapping/clear-button/has-text toggling/double-wrap prevention, initClearButtons filter-search integration, initColResizeSingle resize handle creation and mousedown/mousemove CSS variable update, syncScTableWidths sc-detail/dc-detail width calculation, syncFilterRowHeight graceful no-op, filter-zone collapsed-state persistence and reviewed-mode localStorage isolation, initVirtualScroll threshold gating (<=100 skip, >100 activate), viewport wrapping, row-count indicator, partial rendering, vsRender idempotent re-render and null-guard, vsRefreshVisibility importance-based row filtering with indicator update, vsMaterializeAll full DOM restoration and viewport unwrap, buildExcelFramework header/legend/section/summary/warning assembly, downloadExcelCompatibleHtml small-report immediate path, downloadExcelImmediate blob download with filename, downloadAsPdf print-header/footer injection and afterprint cleanup, downloadReviewed reviewed HTML generation with SHA256 integrity embedding and safe state export, setupLazyIntersectionObserver observer creation/missing-API tolerance/intersection callback, keyboard IME fallback (Process key with KeyJ/KeyK/KeyX code mapping), Escape keyboard focus clear, toggleAllInSection main table header check/uncheck all, toggleAllInDetailTable detail table check/uncheck all (non-virtual-scroll and virtual-scroll with rowData.cbChecked update), syncHeaderCheckboxes indeterminate/checked state (main tables, virtual-scroll detail tables with rowData-based counting), collectState virtual scroll row inclusion for non-DOM entries
Architecture boundary CoreSeparationTests, CiAutomationConfigurationTests, MutationSummaryScriptTests, MutationPrCommentScriptTests utility types stay in the FolderDiffIL4DotNet.Core assembly, the main assembly no longer defines the legacy FolderDiffIL4DotNet.Utils namespace, repository automation keeps coverage gates, release workflow, CodeQL, Dependabot, and benchmark regression workflow configured, mutation-summary automation keeps the extracted scripts/generate-mutation-summary.py entry point plus best-effort PR-comment guardrails wired, the summary script reads thresholds from stryker-config.json, documentation coverage thresholds match the CI workflow, benchmark regression workflow contains expected structure (PR trigger, benchmark-action, alert threshold, fail-on-alert), the mutation-summary script is exercised against valid, zero-mutant, malformed, and missing-report fixtures, and the PR-comment helper covers bot-only selection plus update/create upsert paths for the sticky summary comment
Git test isolation TestGitRepositoryTests temporary Git repositories use one shared initialization path, ignore user/system Git configuration, disable commit/tag signing and hooks locally, run non-interactively, preserve the simulated global configuration file, and still create commits and annotated tags when the isolated global configuration enables signing
Plugin system PluginLoaderTests, FileDiffServiceUnitTests.Hooks, DotNetDisassemblerProviderTests, PluginConfigSettingsTests, ReportFormatterTests, ReportSectionWriterOrderTests Plugin loading from search paths (non-existent path, empty directory, invalid DLL, duplicate search-path deduplication for the same plugin DLL, constructor null-guard, strict-mode pre-load hash rejection when trusted hashes are missing/empty/mismatched), IFileComparisonHook before/after integration (hook override, null passthrough, exception handling, phase-aware failure logs with hook order, multi-hook ordering), DotNetDisassemblerProvider CanHandle for .NET vs non-.NET files, DisplayName/extension-aware warning logs on recoverable detection failures, DisassembleAsync delegation and error handling, plugin config settings round-trip (PluginSearchPaths, PluginEnabledIds, PluginConfig JSON serialization, readonly guarantees), IReportFormatter Order values and IsEnabled conditions, IReportSectionWriter built-in writer count and unique/increasing order invariants
Runner layer CliOverrideApplierTests, DiffPipelineExecutorTests, DryRunExecutorTests, RunScopeBuilderTests, PluginAssemblyLoadContextTests, SpinnerThemesTests CLI override application (--threads, --no-il-cache, --skip-il, --no-timestamp-warnings applied to builder, default options leave builder unchanged), FormatElapsedTime formatting (zero, sub-second, multi-hour), DiffPipelineResult record equality (including HasILFilterWarnings field), constructor null-guards, RunScopeBuilder.BuildExecutionContext network detection and path storage, CreateIlCache conditional creation, DI container service resolution, PluginAssemblyLoadContext collectible context creation and shared assembly fallback, post-process action failures staying best-effort while warning logs retain the action type, execution position, Order, and exception type, and hidden spinner Easter-egg compatibility behavior
Section writer individual HeaderSectionWriterTests, LegendSectionWriterTests, ConditionalSectionWriterTests, FileListSectionWriterTests, SummarySectionWriterTests, IgnoredFilesSectionWriterTests, ILCacheStatsSectionWriterTests, WarningsSectionWriterTests Per-writer Order values, IsEnabled conditions (IgnoredFiles config flag, UnchangedFiles config flag, ILCacheStats config+cache null, Warnings SHA256 mismatch/timestamp regression/IL substring configuration safety), Write output content assertions (report title, app version, paths, computer name, legend SHA256, section headers for Added/Removed/Modified/Unchanged, summary elapsed time, warning keyword, IL substring configuration safety warning text), empty/zero-count result list handling, Ignored early return on empty list, ILCacheStats disabled when cache is null
Plugin unload/cleanup PluginUnloadCleanupTests Collectible AssemblyLoadContext unload (clean unload, unload after assembly load, multiple independent contexts), WeakReference GC reclamation after unload, double-unload InvalidOperationException, Unloading event firing, shared Plugin.Abstractions assembly survives plugin unload
Security (XSS/path traversal) HtmlReportSecurityTests, PathTraversalSecurityTests HtmlEncode XSS prevention (script tags, attribute injection, template literal backticks, double-encoding, control characters, CJK text pass-through, malicious file paths, all five HTML special chars, null/empty), PathValidator traversal prevention (relative escapes, dot/dotdot, null byte/control chars, Windows reserved names, trailing space/dot, absolute paths, Unicode acceptance, extreme path length)
Network share optimization NetworkPathDetectorTests NetworkPathDetector.IsLikelyNetworkPath UNC detection (backslash, forward-slash, device path formats), null/empty/whitespace rejection, local path rejection. The same file also covers DiffExecutionContext network flag propagation (OptimizeForNetworkShares, DetectedNetworkOld/New), null path ArgumentNullException, and IL output path derivation
Property-based testing PropertyBasedTests FsCheck-driven property-based tests: TextDiffer context-line bounds, identity diff produces no changes, patch reconstruction, max output-line cap; TextSanitizer idempotence, no path separators in output, empty/null safety; FileDiffResultLists statistics sum invariant; ConfigSettings MaxParallelism clamping and default positivity
HTML report structural regression HtmlReportVisualRegressionTests 22 structural invariants for generated HTML: DOCTYPE, charset, CSP meta tag, style/script blocks, all report sections (Added/Removed/Modified/Unchanged), <!--CTRL--> markers, checkboxes, text inputs, filter controls, download button, dark-mode CSS, keyboard shortcuts JS, localStorage JS, SHA256 integrity JS, celebration animation, Excel export, theme toggle, data-section/data-importance attributes, seeded file paths, version/computer name embedding, no external resource references, deterministic output across runs
Performance budget PerformanceBudgetTests Coarse performance guardrails (not micro-benchmarks): TextDiffer on 50K identical lines < 500 ms, TextDiffer on 10K lines with 20 changes < 2000 ms, TextSanitizer 100K iterations < 500 ms, FileDiffResultLists SummaryStatistics 1K iterations on 10K files < 100 ms

| JS/CSS minification | JsMinifierTests | Minify JS comment stripping (trailing comments, comment-only lines, blank line removal), string literal preservation (single-quoted // URLs, double-quoted // URLs, escaped quotes inside strings, mixed quote nesting), whitespace preservation for downloadReviewed() patterns, null/empty/whitespace-only input handling, MinifyCss block comment removal, important comment (/*! ... */) preservation, unterminated comment graceful handling, CSS whitespace preservation | | Exception filters | ExceptionFiltersTests | IsFileIoRecoverable true/false matrix (IOException, UnauthorizedAccessException, NotSupportedException → true; InvalidOperationException, NullReferenceException, ArgumentException → false; FileNotFoundException subclass → true), IsFileIoOrOperationRecoverable (InvalidOperationException inclusion), IsPathOrFileIoRecoverable (ArgumentException/ArgumentNullException inclusion, InvalidOperationException exclusion), IsProcessExecutionRecoverable (Win32Exception inclusion, ArgumentException exclusion) | | Path-shape diagnostics | PathShapeDiagnosticsTests | DescribeRootedState returns Unknown for null/empty/whitespace/embedded-NUL inputs, False for relative paths, True for absolute paths; LooksLikePath returns false for null/empty/embedded-NUL/plain command names and true for forward-slash paths, platform directory-separator paths, and absolute paths; DescribeState composes <Label>IsPathRooted= + <Label>LooksPathLike= fragments and downgrades malformed inputs to Unknown/False without throwing. Pins the load-bearing diagnostic helper used by audit log, SBOM, report writers, cache layers, disassembler launcher, logger cleanup, preflight validator, plugin loader, open-folder commands, and IL text writer. | | Assembly SDK version | AssemblySdkVersionReaderTests | FormatTargetFramework conversion (.NETCoreApp → .NET, .NETFramework → .NET Framework, .NETStandard → .NET Standard, unknown framework, no-comma raw value, Version= fallback without v prefix), ReadTargetFramework real assembly extraction, non-existent file null return, non-assembly file null return, empty file null return, ReadPairDisplayString same-version single string, both-null return, one-side-null fallback | | Timestamp caching | TimestampCacheTests | GetOrAdd cache hit/miss (second call returns same value), null/empty ArgumentException, Clear invalidation (modified file timestamp detected after clear), case-insensitive key matching |

Testability-related structure:

Recommended starting points by change type:

Run Tests Locally

All tests:

dotnet test FolderDiffIL4DotNet.Tests/FolderDiffIL4DotNet.Tests.csproj --configuration Release --nologo

With coverage (Cobertura XML + opencover, using .runsettings):

dotnet test FolderDiffIL4DotNet.Tests/FolderDiffIL4DotNet.Tests.csproj --configuration Release --nologo --settings coverlet.runsettings --collect:"XPlat Code Coverage" --results-directory ./TestResults

Run one class:

dotnet test FolderDiffIL4DotNet.Tests/FolderDiffIL4DotNet.Tests.csproj --configuration Release --nologo -p:UseAppHost=false --filter "FullyQualifiedName~FolderDiffIL4DotNet.Tests.Services.FolderDiffServiceTests"

Run one test method:

dotnet test FolderDiffIL4DotNet.Tests/FolderDiffIL4DotNet.Tests.csproj --configuration Release --nologo -p:UseAppHost=false --filter "FullyQualifiedName~Main_WithValidArguments_ReturnsSuccessAndGeneratesReport"

Run only the lightweight unit tests for folder classification:

dotnet test FolderDiffIL4DotNet.Tests/FolderDiffIL4DotNet.Tests.csproj --configuration Release --nologo -p:UseAppHost=false --filter "Category=Unit"

Run the filesystem-backed integration tests:

dotnet test FolderDiffIL4DotNet.Tests/FolderDiffIL4DotNet.Tests.csproj --configuration Release --nologo -p:UseAppHost=false --filter "Category=Integration"

Run only the real-disassembler end-to-end tests (requires FOLDERDIFF_RUN_E2E=true):

FOLDERDIFF_RUN_E2E=true dotnet test FolderDiffIL4DotNet.Tests/FolderDiffIL4DotNet.Tests.csproj --configuration Release --nologo -p:UseAppHost=false --filter "Category=E2E"

Run the complete HTML-report JavaScript suite and the same npm audit gate used by CI (use Node.js 24.18.0 from .node-version):

npm ci
npm run test:js
npm run audit:high

The audit gate fails on every High/Critical advisory except exact, time-bounded entries in npm-audit-exceptions.json. There are currently no active npm audit exceptions; the locked Jest graph selects patched brace-expansion releases through the overrides in package.json. A separate --omit=dev audit enforces that any future exception remains limited to development dependencies. scripts/npm-audit-gate.js also fails on an expired exception or if npm audit cannot return a valid report.

Run the NuGet audit-gate tests and the same full-solution direct/transitive dependency audit used by CI:

python3 -m unittest discover -s scripts/tests -p 'test_*.py'
python3 scripts/nuget_audit_gate.py --solution FolderDiffIL4DotNet.sln

scripts/nuget_audit_gate.py runs dotnet list FolderDiffIL4DotNet.sln package --vulnerable --include-transitive --format json --output-version 1 --source https://api.nuget.org/v3/index.json, prints every reported advisory, writes the result to the GitHub job summary when available, and fails on any direct or transitive High/Critical finding. It explicitly requires the advisory-capable nuget.org source and fails closed if the command or JSON report is invalid or incomplete. There are no active NuGet audit exceptions; any proposed temporary exception must document its advisory, rationale, exact dependency/project scope, and expiry before the CI policy is changed.

Run performance benchmarks (BenchmarkDotNet):

dotnet run -c Release --project FolderDiffIL4DotNet.Benchmarks

# Run a specific benchmark class
dotnet run -c Release --project FolderDiffIL4DotNet.Benchmarks -- --filter *TextDiffer*

The benchmark CI job (workflow_dispatch only) runs all benchmarks with JSON and GitHub exporters and uploads BenchmarkDotNet.Artifacts/ as a CI artifact. The benchmark-regression workflow (.github/workflows/benchmark-regression.yml) runs automatically on PRs to main. scripts/check_benchmark_regressions.py uses a compatible-history median and the evidence-based per-group warning/failure limits in benchmark-regression-policy.json. Controlled Python fixtures exercise median calculation, exact threshold boundaries, intended-base ancestry, warmup/reset behavior, definition mismatch, environment isolation, missing/mixed host rejection, report combination, and intentional baseline publication; run them with the python3 -m unittest discover command above.

CI-parity command (same as GitHub Actions test step):

FOLDERDIFF_RUN_E2E=true DOTNET_ROLL_FORWARD=Major dotnet test FolderDiffIL4DotNet.Tests/FolderDiffIL4DotNet.Tests.csproj --configuration Release --no-build --nologo --settings coverlet.runsettings --logger "trx;LogFileName=test_results.trx" --collect:"XPlat Code Coverage" --results-directory ./TestResults

Run mutation testing (Stryker.NET):

dotnet tool restore
dotnet tool run dotnet-stryker --config-file stryker-config.json --output StrykerOutput

Local runs write HTML/JSON reports under StrykerOutput/**/reports/. CI uses the same output folder, appends mutation-summary.md to the GitHub Actions job summary, uploads per-run StrykerSummary-* and StrykerReport-* artifacts, and posts the same summary as a sticky bot comment on same-repository pull requests. The PR comment step is best-effort, so GitHub comment API failures do not fail the mutation gate. Treat the Actions run history plus those per-run artifacts as the canonical mutation-score trend record. The extracted helper scripts intentionally avoid Python 3.10+-only and modern Node-only syntax, so the workflow and local architecture tests can keep using the same plain python3 / node launchers. The npm/Jest supply-chain job is pinned separately through .node-version.

Coverage Reporting

After running with coverage, results are created under TestResults/**/coverage.cobertura.xml.

Coverage percentages vary as code and tests change. Generate a fresh local report when you need the current values, and use CI as the authoritative enforcement point. CI fails if total coverage drops below 80% line or 75% branch. Additionally, core diff classes (FileDiffService, FolderDiffService, FileComparisonService) must keep per-class baseline floors of 85% line and 65% branch.

Optional local summary generation (uses the local tool manifest):

dotnet tool restore
dotnet tool run reportgenerator -reports:"TestResults/**/coverage.cobertura.xml" -targetdir:"CoverageReport" -reporttypes:"MarkdownSummaryGithub;Cobertura;HtmlInline_AzurePipelines"

The coverlet.runsettings file configures:

  • Include/Exclude filters: Only [nildiff]* and [FolderDiffIL4DotNet.Core]* assemblies are measured; test and benchmark assemblies are excluded.
  • Attribute exclusions: [ExcludeFromCodeCoverage], [GeneratedCode], [CompilerGenerated], and [Obsolete] attributed members are excluded.
  • Output formats: Both cobertura (for CI threshold enforcement) and opencover (for detailed IDE analysis) are generated.
  • Deterministic report: DeterministicReport=true ensures reproducible output across CI runs.

CI Integration Notes

Workflow/config files: .github/workflows/dotnet.yml, .github/workflows/release.yml, .github/workflows/codeql.yml, .github/dependabot.yml

  • DocFX site generation runs before tests and publishes _site/ as the DocumentationSite artifact.
  • Tests and coverage run only when FolderDiffIL4DotNet.Tests/FolderDiffIL4DotNet.Tests.csproj exists.
  • .NET validation runs in three blocking jobs. The build job (Ubuntu) installs a real dotnet-ildasm tool, adds the global-tool directory to PATH, and runs the test step with both DOTNET_ROLL_FORWARD=Major and FOLDERDIFF_RUN_E2E=true; the test-windows job (Windows) does the same on windows-latest.
  • The test-macos job runs on macos-latest for every pull request, supported-branch push, and manual dispatch configured for the workflow. It builds Release, runs the stable suite, and directly executes the generated apphost. The smoke test checks executable permission, --doctor tool discovery, temporary POSIX paths containing spaces and case variants, report generation, and the expected reportable-difference exit code 5.
  • macOS excludes only E2E tests because hosted-runner behavior for the external disassembler is not yet proven stable, and Performance tests because timing assertions are unsuitable for shared hosted runners. Unit coverage for path/case handling, temporary directories, and deterministic fake-tool discovery remains enabled. The job has no job-level condition or continue-on-error, so it is blocking; a 20-minute timeout and the two narrow exclusions bound its cost. Real-disassembler macOS E2E remains deferred until hosted-runner stability is established.
  • The blocking javascript-tests job uses the exact Node.js version in .node-version, keys the npm cache from package-lock.json, restores with npm ci, runs the complete Jest suite, and fails on newly introduced High/Critical npm advisories through npm run audit:high. The gate permits only advisory dependency chains rooted in an unexpired exact match from npm-audit-exceptions.json; unrelated findings, expired exceptions, and invalid audit responses fail CI.
  • TestAndCoverage artifact includes TRX and coverage outputs.
  • CoverageReport/SummaryGithub.md is appended to GitHub Step Summary when present.
  • A dedicated threshold step parses coverage.cobertura.xml and fails the workflow if total coverage falls below 80% line or 75% branch. The same step also enforces per-class baseline floors (85% line, 65% branch) for core diff classes (FileDiffService, FolderDiffService, FileComparisonService).
  • The mutation-testing job writes StrykerOutput/mutation-summary.md plus mutation-summary.json, appends the markdown summary to GitHub Step Summary, uploads per-run StrykerSummary-* and StrykerReport-* artifacts, and mirrors the same summary into a sticky PR comment for same-repository pull requests.
  • The extracted scripts/generate-mutation-summary.py helper is covered by direct architecture tests so score extraction, zero-mutant handling, survivor aggregation, and missing/malformed-report fallback can fail fast before GitHub Actions runs.
  • The extracted scripts/update-mutation-pr-comment.js helper is covered by direct architecture tests so sticky-comment updates stay limited to bot-owned marker comments.
  • .github/workflows/release.yml runs on v* tags, rebuilds/tests/publishes the app, archives publish/docs output, and creates a GitHub Release from the pushed tag. Its release coverage gate matches the main CI thresholds (80% line, 75% branch).
  • .github/workflows/codeql.yml runs CodeQL for both csharp and actions on code changes plus a weekly schedule; uses fetch-depth: 0 on checkout for Nerdbank.GitVersioning and blocks the Analyze step on serious findings.
  • .github/dependabot.yml enables weekly update PRs for NuGet, GitHub Actions, and npm. Those npm pull requests run the same javascript-tests gate as other pull requests.
  • CiAutomationConfigurationTests keeps those repository-automation files under automated regression coverage.
  • A "Validate test scope map" step runs scripts/validate-test-scope-map.py to verify that all test class files are listed in this guide's scope map table. This step is non-blocking (continue-on-error: true) but warns when new test classes are not yet documented.

Test Isolation and Environment Notes

  • Most tests create unique temporary directories under Path.GetTempPath() and clean them up in Dispose/finally.
  • Git-based tests must create repositories through TestGitRepository. It uses test-only global/system configuration, removes inherited repository and identity environment variables, disables commit/tag signing and hooks locally, and forces non-interactive Git behavior without modifying the user's configuration.
  • ProgramTests temporarily writes config.json under AppContext.BaseDirectory and restores original content.
  • DotNetDisassembleServiceTests temporarily rewires PATH/HOME and uses scripted fake tools to test fallback/blacklist logic deterministically; any test that pre-seeds a specific disassembler version into the version cache must also prepend a matching fake tool to PATH so that GetVersionWithFallbacksAsync finds the fake before the real tool installed on the CI runner, which would otherwise overwrite the seeded entry.
  • RealDisassemblerE2ETests builds throwaway class libraries under temp directories and pins the E2E assertion to dotnet-ildasm; CI ensures that prerequisite, adds the global tool directory to PATH, and sets both DOTNET_ROLL_FORWARD=Major and FOLDERDIFF_RUN_E2E=true for the blocking test step.
  • Some disassembler tests are skipped on Windows using [SkippableFact] + Skip.If(OperatingSystem.IsWindows(), ...), which reports them as Skipped in the test runner rather than silently passing. RealDisassemblerE2ETests is skipped only when the explicit E2E opt-in is absent; once FOLDERDIFF_RUN_E2E=true is set, missing or non-runnable dotnet-ildasm is treated as a test failure rather than a skip.
  • Unit tests do not require globally installed real dotnet-ildasm or ilspycmd for most scenarios because test doubles are used.
  • Avoid adding static mutable test hooks. Prefer constructor injection plus DiffExecutionContext for per-run values.
  • The test project has <Nullable>enable</Nullable> enabled and enforces CS8603 (possible null reference return). It still suppresses nullable warnings (CS8600, CS8604, CS8605, CS8618, CS8619, CS8620, CS8625) and xUnit1012 via <NoWarn> in the .csproj. The remaining suppressions cover test code that deliberately passes null to verify argument validation, null-guard branches, and graceful failure paths; they should be removed incrementally as those call sites become explicitly annotated.

Adding or Updating Tests

  • Keep tests deterministic: avoid network dependency, wall-clock assumptions, and global mutable state.
  • Use unique temp roots per test class or test case.
  • Always restore environment variables and temporary config files changed during tests.
  • Prefer asserting observable behavior (result classification/report content/log side-effects) over internal implementation details.
  • If test project path/name changes, update .github/workflows/dotnet.yml test/coverage conditions and any repository-automation assertions in CiAutomationConfigurationTests.
  • If release or security automation changes, update .github/workflows/release.yml, .github/workflows/codeql.yml, .github/dependabot.yml, and CiAutomationConfigurationTests in the same change.
  • If the public API surface changes, regenerate the DocFX site and make sure XML comments still describe the new members correctly.
  • If user-visible execution behavior changes, also update README.md and doc/DEVELOPER_GUIDE.md in the same change.
  • If the runtime lifecycle or service boundaries change, confirm the terminology in tests still matches the developer guide.

テストガイド(日本語)

このドキュメントは、プロジェクトのテスト戦略、実行手順、拡張時の注意点を集約したものです。

関連ドキュメント:

テストスタック

パッケージのバージョンは今後も変わるため、現行値の正本は FolderDiffIL4DotNet.Tests/FolderDiffIL4DotNet.Tests.csproj、.config/dotnet-tools.json、package.json を参照してください。

現在のテスト範囲マップ

ローカルでのテスト実行 にあるコマンドを使い、その時点の総件数、成功/失敗件数、スキップ件数を確認してください。このガイドでは、変動しやすい実行結果の件数は固定せず、対象範囲と意味の説明を優先します。

バージョンメタデータの回帰テストでは、SystemInfo が 3 要素の公開 SemVer と診断用の詳細ビルドバージョンを分離すること、--version と --doctor が意図した形式を使うこと、および README/パッケージ/サンプルのメタデータが version.json と一致することを検証します。

領域 主なテストクラス 主な検証内容
エントリーポイント/設定 ProgramTests, ProgramRunnerTests, CliOptionsTests, ConfigServiceTests, ConfigSettingsTests Main の終了コード、引数不正と設定失敗を分ける ProgramRunner の型付き終了コード分類、引数検証と設定読込の順序、最小構成の実行、CliParser による CLI 引数解析(null/空/位置引数のみ、文書化済みの全フラグと非表示のスピナーイースターエッグ互換フラグ、未知フラグ検出、全フラグ組み合わせ、--config/--threads の値欠落エラー、スピナー最後勝ち動作、複数スピナー検出(MultipleSpinnersDetected))、コード既定値(ConfigSettings.Default* 名前付き定数で検証)と override の設定挙動、更新日時警告のコンソール/レポート出力、ProgramRunner が内部 IL キャッシュ既定値をどう配線するかの検証、完了サマリーチャート出力(各ファイルカテゴリのバー描画、合計ゼロ時のスキップ、ラベル揃え)、JSON 書式エラーの報告(オブジェクト末尾カンマ {"Key":"v",}、配列末尾カンマ ["a","b",]、複数行 JSON での InvalidDataException メッセージへの行番号付与、line N, position N パターン検証、全 JSON パースエラーへのトレイリングカンマヒント付与、カスタム設定パスの FileNotFoundException でパスがメッセージに含まれること)、プリフライト書込権限チェックにおける IOException の fail-fast 処理(サイレントスワロー排除)と ILoggerService 経由の原因別ログ出力、--help テキストの「Tip:」セクションで --print-config を紹介、非表示のスピナーイースターエッグフラグを解析できる一方で --help 出力と現行ユーザー向け文書には掲載しないこと、設定エラー(終了コード 3)時の stderr への --print-config ヒント出力、--wizard 対話モードのリダイレクト stdin 拒否(終了コード 2 とエラーメッセージ)、--clear-cache 対話ウィザードのリダイレクト stdin 拒否(終了コード 2 とエラーメッセージ)、--help 出力に --clear-cache オプション表示、--open-reports/--open-config/--open-logs 早期終了、フォルダパス出力、--output/--config 指定時の連携、複数フラグ同時指定時の既定ターゲット順(Reports → アプリケーションデータルート / 設定ディレクトリ → Logs)、1 件目/2 件目の起動失敗時の short-circuit、および起動処理失敗時に解決済みターゲットパス付きでエラーを返すこと、CheckDiskSpaceOrThrow 空パススキップ、CheckReportsParentWritableOrThrow 空親パススキップとプローブファイルクリーンアップ検証、--help 出力にフォルダ開放オプション表示、IL キャッシュヘルパーメソッド(FilterCacheFilesByTool ツール名マッチングと短ファイル名スキップ、FilterCacheFilesByToolLabel サニタイズ往復による正確なバージョンマッチング、ExtractDistinctToolLabels キャッシュファイル名からの一意ソート済みラベル抽出と重複排除・短ファイル名スキップ、UnsanitizeToolLabel バージョンパターン逆変換とバージョンなしフォールバック、SanitizeForCacheMatch コロン/括弧置換、サニタイズ→逆サニタイズ往復一致性)、--output によるカスタム出力ディレクトリ(パス指定・値欠落エラー・デフォルト null)、GetReportsFolderAbsolutePath のカスタム/null/空出力ディレクトリ、NormalizeDragDropPath ドラッグ&ドロップパス正規化(二重/単一引用符、file:///file:/// URI プレフィックス、バックスラッシュエスケープ空白、日本語を含むパーセントエンコード文字、複合形式、空入力、不正パーセントエンコーディング)、未解決 LocalApplicationData を通常実行と --open-reports でどう分類するか、active reports root に合わせた --help 文言、および user-local / bundled fallback の不正 JSON に対する解決済みパス付き stderr 診断
差分処理本体 FolderDiffExecutionStrategyTests, FolderDiffServiceTests, FolderDiffServiceUnitTests, FileDiffServiceTests, FileDiffServiceUnitTests, FileDiffResultListsTests, DiffExecutionContextTests 列挙フィルタ、自動並列度ポリシー(I/O バウンドのローカルパスでは ProcessorCount × 2、ネットワーク共有では上限キャップ)、Unchanged/Added/Removed/Modified の分類、判定理由、Modified と判定されたファイルのみを対象とした更新日時逆転検出(Unchanged ファイルは更新日時が逆転しても警告対象外)、状態リセット、拡張子大小無視、伝播したテキスト比較例外からのフォールバック、権限エラー/出力先 I/O 失敗、想定例外と想定外例外のログ/再スロー境界、大量ファイルの扱い、大規模ツリー向け IL 事前計算バッチ化、大きいテキスト比較のメモリ予算ベース抑制、複数 MiB の実ファイル比較、シンボリックリンク経由の分類、ファイル単位のハッシュ/IL/テキスト分岐の異常系、列挙時のシンボリックリンクループ IOException(ログ出力のうえ再スロー)、比較前ファイル削除時の FileNotFoundException を Removed 分類+警告(逐次・並列両対応)、DiffSummaryStatistics/SummaryStatistics のスナップショット正確性、完了メッセージが直接 Console.WriteLine ではなく ILoggerService 経由で出力されることの検証、差分パイプラインへの CancellationToken 伝播(キャンセル済みトークンで OperationCanceledException がスローされること)、ベストエフォートセマンティック解析の CA1031 フォールバック(AssemblyMethodAnalyzer.Analyze が存在しないパスで失敗した場合に警告ログのみで差分結果に影響しないこと)、FolderDiffExecutionStrategy.CountDotNetAssemblyCandidates の空入力時挙動、重複パス抑止、マネージドアセンブリのみのカウント、ファイル単位の進捗 100% 到達、DiffExecutionContext コンストラクタの null パラメータ検証(oldFolderAbsolutePath/newFolderAbsolutePath/reportsFolderAbsolutePath 各 ArgumentNullException)、レポートフォルダからの IL 出力サブパス導出、ネットワーク共有フラグの保持
依存関係分析 DepsJsonAnalyzerTests、NuGetVersionRangeTests、NuGetVulnerabilityServiceTests .deps.json ファイルの構造化された依存関係変更分析: パッケージの追加/削除/更新検出、semver による重要度分類(メジャー=High、マイナー=Medium、パッチ=Low)、大小区別なしのパッケージ名、不正 JSON/ファイル不在での安全なフォールバック(null 返却)、DependencyChangeSummary の最大重要度と重要度順ソート、runtime/compile ターゲット付きの実際の .deps.json 構造パース;NuGet バージョン範囲の解析と包含判定(完全一致 [x.y.z]、開区間/閉区間 [min, max)、プレリリースサフィックス除去、4 パートバージョン、エッジケース);NuGet V3 脆弱性 API 連携(インデックスページ URL パース、脆弱性ページパース、DepsJsonAnalyzer.Analyze ファイル不在時の onError コールバック呼び出し、正常解析時の onError 非呼び出し、不正 targets セクションのグレースフルハンドリング、旧/新バージョン検出によるパッケージ別脆弱性チェック、解消済み vs 新規導入の脆弱性判定、深刻度ラベルマッピング、DependencyChangeSummary 脆弱性カウントプロパティ、一時障害後の再試行、OperationCanceledException の伝播、例外型を保持したページ単位の警告ログ、脆弱性インデックス取得失敗時の index URL 付き警告、外側 best-effort failure ログの entry/package 件数、インデックス取得時の OperationCanceledException 伝播)
IL/逆アセンブラ ILOutputServiceTests, ILBlockParserTests, DotNetDisassembleServiceTests, DisassemblerBlacklistTests, DisassemblerHelperTests, DotNetDisassemblerCacheTests, DotNetDetectorTests, AssemblyMethodAnalyzerTests, AssemblySemanticChangesSummaryTests, ChangeImportanceClassifierTests, ChangeTagClassifierTests, CompilerGeneratedResolverTests 同一逆アセンブラ比較、フォールバック、ブロック単位順序非依存 IL 比較(BlockAwareSequenceEqual)によるメソッド並び替え耐性、IL ブロック解析(ILBlockParser.ParseBlocks)のプリアンブル/メソッド/クラス/ネスト波括弧対応、ブラックリスト(TTL 境界: 10 分のブラックリスト期間経過後にエントリが削除され、ツールが再試行されることを含む)、ツール独立状態、RegisterFailure/ResetFailure の null/空白文字ガード(null ガードの true 分岐を明示的にカバー)、存在しないコマンドの reset、32 スレッドの並行 RegisterFailure、TTL 切れ境界での並行呼び出し(例外なし)、検出・コマンド処理、判定失敗と非 .NET の区別;ResolveExecutablePath のブランチ網羅(ディレクトリ区切り文字を含む相対パス(存在あり/なし)、空白のみの PATH 環境変数、空文字列の PATH エントリ、PATH 検索によるコマンド発見);Windows 専用 EnumerateExecutableNames テスト(.exe/.cmd/.bat 拡張子を持つコマンドに重複拡張子が追加されないことを検証);ProbeAllCandidates 利用可否プローブが dotnet-ildasm と ilspycmd の両方を含む一意ツール名の非空リストを返すこと;BuildInstallSuggestion OS 別インストールコマンドの存在、英日バイリンガルテキストと --skip-il ヒント、Windows/macOS/Linux の PATH 案内;アセンブリセマンティック解析がメソッドのアクセス/修飾子変更およびプロパティ/フィールドの型/アクセス/修飾子変更を Modified エントリとして検出;ChangeImportanceClassifier が全重要度レベルを正しく分類(public/protected 削除やアクセス縮小は High、public 追加や internal 削除は Medium、ボディのみ変更や private 追加は Low)、WithClassifiedImportance が全フィールドを保持;AssemblySemanticChangesSummary の重要度カウント・最大重要度・重要度順ソート、CA1031 catch-all フォールバック:破損/切り詰め/空の PE ファイルで例外ではなく null を返すこと、正常と破損の非対称アセンブリペア;ストリーミング IL 比較(StreamingFilteredSequenceEqual)の組み込み MVID 正規化・設定正規化文字列・設定文字列除外・空入力・長さ不一致・全行除外時の一致・従来の SplitAndFilterIlLines + SequenceEqual との動作等価性検証;FilterIlLines の除外あり/なし行フィルタリング;SplitToLines の LF・CRLF・空文字列・null・末尾改行入力の行分割;ChangeTagClassifier のヒューリスティックパターン検出(Extract 同一型内 Modified+private 追加、Inline 逆パターン、Move 型間移動、Rename 同一型で名前変更、Signature/Access/BodyEdit のアロー検出、DepUpdate 依存関係のみの変更)、FormatTags カンマ区切りフォーマット、GetLabel ラベルマッピング、エッジケース(public メソッドが Extract に消費されないこと、同一型で Move がトリガーされないこと);ValidateILIgnoreContainingStrings 安全性検証(null 入力、空入力、全て安全な文字列、短い文字列の警告、混合長、最小長ちょうどの境界値);コンパイラ生成名解決(CompilerGeneratedResolver):async ステートマシン、ディスプレイクラス、ラムダメソッド、バッキングフィールド、ローカル関数、record クローン/合成メンバーの注釈と検出;SimpleSignatureTypeProvider.GetGenericInstantiation 深いネストを含むジェネリクスのアリティサフィックス除去、GetTypeFromReference ResolutionScope 経由のネスト型解決、ランタイムアセンブリのジェネリックシグネチャにバッククォートアリティが含まれないことの検証;Analyze オプショナル onError コールバックの失敗時呼び出しと成功時非呼び出し
実逆アセンブラ E2E RealDisassemblerE2ETests Deterministic=false の同一クラスライブラリを 2 回ビルドし、再ビルド DLL が SHA256 では不一致でも、dotnet-ildasm では MVID 正規化後に ILMatch になることを検証
実 IL 出力コーパス ILOutputCorpusTests、Fixtures/ILCorpus 通常型とcompiler-generated type、class内method、generic、async/iterator/lambda、property/event/field、AssemblyRef、再現可能なCOM interop metadataを含む1つの署名済みサンプルAssemblyについて、dotnet-ildasm 0.12.2.0 と、.NET 8/9/10をtarget frameworkとするAssemblyを調査するfallback baselineである ilspycmd 9.1.0.7988 の実出力を固定し、コーパスの完全性、各ツールの実構文、由来に関係なく全組み込み規則が適用されることを検証
フォルダ差分→レポート E2E FolderDiffReportE2ETests フルパイプライン統合テスト:フォルダ差分 → Markdown/HTML/監査ログ生成 → 出力検証、全ファイル変更なしシナリオ(ゼロ変更サマリー)、サブディレクトリ相対パスの全レポート種別での保持、並列/逐次分類の整合性、監査ログの SHA256 ハッシュが生成レポートを参照すること(64文字16進、ファイルごとに異なる)、HTML インタラクティブ要素(チェックボックス、autoSave、collectState、applyFilters、CSP、SHA256 整合性コード)、変更テキストファイルへのインライン差分コンテンツ
キャッシュ ILCacheTests、ILDiskCacheTests、ILCachePrefetcherTests、ILCacheConcurrencyTests、ILCacheDiskFailureTests メモリ/ディスクキャッシュの保持、同一キー再保存、退避時の連動削除、キー生成、メモリ/ディスクモードでの並列 Set/Get、競合下の LRU 退去、TTL 期限切れレース、ディスク I/O 障害シミュレーション(読み取り専用ディレクトリ、破損ファイル、操作中ディレクトリ削除、0バイトキャッシュファイル、無効パスへの並行書き込み)、無効なキャッシュディレクトリ初期化・空キャッシュキー・長すぎるキャッシュキー由来のパス失敗・クォータトリム文脈ログに対するディスク層の直接テスト、ディスククォータ適用(MaxDiskFileCount トリミング、サイズ制限トリミング)、読み取り専用ディレクトリへの高速連続書き込みとメモリフォールバック、IL キャッシュプリフェッチの引数バリデーション(null/空入力、不正 maxParallel)、キャッシュ無効時および null キャッシュ時のプリフェッチ処理、キャッシュヒットカウンタの追跡、コンストラクタ null ガードチェック
エッジケース DisassemblerBlacklistTtlRecoveryTests、LargeFileComparisonTests、SymlinkAndCircularDirectoryTests、FolderDiffConcurrencyStressTests DisassemblerBlacklist の TTL 復旧サイクルと並列 register/check、4 MiB ファイルのチャンク並列比較、シンボリックリンクループ/ダングリング処理、500 ファイル並列分類の決定論性、レイテンシシミュレーション付きストレステスト
ゴールデンファイルスナップショット GoldenFileSnapshotTests、GoldenReportSampleConsistencyTests GoldenFileSnapshotTests は doc/samples/diff_report.md の構造検証(セクション存在、セクション順序、セクション件数と Summary の整合、逆アセンブラ利用可否テーブル形式、Modified ファイルの重要度レベル、凡例テーブル、IL Cache Stats メトリクス、ヘッダーメタデータフィールド、警告タイプ)、レポート生成の決定論テスト(同一データから2回生成し Markdown/HTML の同一出力を検証)、生成レポートの構造検証(メタデータ、ファイルカテゴリ、差分詳細ラベル、重要度レベル)を行います。GoldenReportSampleConsistencyTests は、commit 済み Markdown/HTML の正規化テーブルが、順序を含めた creator-default profile 全体と sample 固有の overlap warning 用設定値に一致することを別途検証します。
レポート/ログ/進捗 ReportGenerateServiceTests、HtmlReportGenerateServiceTests、AuditLogGenerateServiceTests、SbomGenerateServiceTests、LoggerServiceTests、ProgressReportServiceTests、TestLoggerTests、ReviewChecklistLoaderTests レポート出力内容、ログ動作、共有ログ書式、JSON ログ形式での W3C Trace Context(Initialize() 後に 32 桁 16 進の traceId、エントリごとの spanId)、進捗報告ライフサイクル、インライン進捗/リダイレクト進捗の固定長 ETA 表示・上限クランプ・placeholder 挙動、HTML レポートのファイル生成・チェックボックス/入力要素の存在・セマンティック変更詳細テーブルの一括チェックヘッダー(.cb-all-detail クラス)、メインテーブルの一括チェックヘッダー(.cb-all クラス、data-section 属性、toggleAllInSection ハンドラ、id 属性なし)、ステートモジュールの仮想スクロール対応(table.__vs、rowData[i].cbChecked、table.vs-active、rd.cbId)、init モジュールのヘッダーチェックボックス autoSave リスナー除外(.cb-all、.cb-all-detail)・セクション色付け・localStorage センチネル・ShouldGenerateHtmlReport=false スキップ・特殊文字の HTML エンコード(WebUtility.HtmlEncode によるバッククォート・非 ASCII 対応、Unicode/混在スクリプト XSS 防止、通常テキスト保持)、Content-Security-Policy メタタグの存在と配置順序(charset と viewport の間)、インライン差分サマリーの #N 番号と左端 # 列の整合、Modified・Unchanged セクションでの Unicode ファイル名(日本語/ウムラウト/中国語)のラウンドトリップ、10,500 件の大件数サマリー統計の正確性、InlineDiffMaxDiffLines による抑制(差分を計算した後、差分出力行数が閾値を超えた場合にスキップ)、凡例テーブル形式、stat-table 列ヘッダと可視ボーダー、InlineDiffMaxEditDistance code タグ、diff-row 背景色、クリップボードコピーボタン、行ホバーハイライト、テーブルソート順(Unchanged: SHA256Match → ILMatch → TextMatch 後にパス昇順、Modified/Warnings: TextMismatch → ILMismatch → SHA256Mismatch 後にパス昇順)、SHA256Mismatch 警告詳細テーブル(ファイル一覧、アルファベット順ソート、Timestamps Regressed テーブルの前に表示、各警告メッセージの直下に詳細テーブルを配置するインターリーブレイアウト)、HTML・Markdown 両レポートにおけるセマンティックサマリー注意書きの存在と CSS スタイル、ダークモード CSS カスタムプロパティ(prefers-color-scheme)とテーマ対応ユーティリティクラス(.imp-high、.imp-medium、.status-available、.status-unavailable、.vuln-new、.vuln-resolved、.warn-danger、.warn-caution)、構造化 JSON 監査ログ生成(audit_log.json)―メタデータ/サマリー/ファイルエントリ/SHA256 インテグリティハッシュ、ShouldGenerateAuditLog=false スキップ、異なるレポート内容で異なるハッシュが生成される改竄検知、空結果処理、コンストラクタ null チェック、レビュー済み HTML の SHA256 整合性検証コード存在確認(Web Crypto API crypto.subtle.digest、コンパニオン .sha256 ファイル、__reviewedSha256__/__finalSha256__ センチネル、accept='.sha256' 付き事前作成ファイル入力、verifyIntegrity 自己検証関数)、Access・Modifiers 列の <code> ラッピングと矢印対応フォーマット(CodeWrapArrow)、Markdown/HTML レポートヘッダの逆アセンブラ利用可否テーブル(プローブ結果がある場合は表示、null の場合は非表示)、監査ログ JSON の disassemblerAvailability 配列、インタラクティブフィルターゾーンの存在(Diff Detail/重要度/未チェックのみ/検索コントロール)、フィルターゾーンが <!--CTRL-->...<!--/CTRL--> マーカー外に配置され review 済み HTML でも残ること、ファイル行の data-section/data-importance 属性、filter-hidden/filter-hidden-parent CSS ルール、applyFilters()/resetFilters() JS 関数、__filterIds__ による collectState() からの除外、downloadReviewed() が outerHTML キャプチャ前に filter-hidden クラスをクリアすること、downloadReviewed() が outerHTML キャプチャ後に applyFilters() を呼び出しライブページのフィルタ状態を復元すること、Excel 互換 HTML エクスポート関数の存在(downloadExcelCompatibleHtml、buildExcelRow)、Excel エクスポートボタンが <!--CTRL--> マーカー外に配置されていること、テーマ切替ボタンの存在と <!--CTRL--> マーカー外への配置(cycleTheme、initTheme)、完了セレブレーションアニメーション CSS/JS の存在(celebrate-container、celebrate-rise、celebrateCompletion、__celebrationFired__、prefers-reduced-motion 尊重)、フェーズ別進捗番号付け(BeginPhase ラベルフォーマット [current/total]、フェーズカウンタの増分、フェーズ遷移時の進捗リセット、フェーズごとの経過時間ログ出力、FormatPhaseElapsed フォーマット、TotalPhases バリデーション、Dispose 時の最終フェーズログ出力)、IL シンタックスハイライト CSS クラス(.hl-directive、.hl-keyword、.hl-type、.hl-string、.hl-comment、.hl-label)、IL ハイライト色変数(--color-hl-*)のライト/ダークテーマ対応、ハイライト JS モジュール関数の存在確認(highlightILCell、highlightILDiff、highlightAllILDiffs、__ilPatterns__)、キーボードショートカット JS モジュール関数の存在確認(moveBy、toggleCheck、toggleHelp、isTyping、__kbEscHandled__)、キーボードフォーカスおよびヘルプオーバーレイ CSS スタイル(tr.kb-focus、.kb-help、.kb-help-visible、.kb-help-hidden、backdrop-filter)、キーボードヘルプオーバーレイ HTML の存在(id="kb-help"、Keyboard Shortcuts、<kbd> 要素)、ストレージバー要素の存在(storage-group、storage-bar、storage-fill、storage-text)、ツールチップ付き「Free up review storage」ボタン(btn-tooltip-wrap、btn-tooltip、clearOldReviewStates)、updateStorageUsage/clearOldReviewStates JS 関数の存在、setupLazyIntersectionObserver JS 関数と IntersectionObserver の存在、チャンク Excel エクスポート関数(downloadExcelChunked、finalizeExcelDownload、buildExcelFramework、downloadExcelImmediate)、ログレベルプレフィックス幅統一([INFO ]、[WARNING]、[ERROR ])アサーション、TestLogger の並列ログ取得とコールバック整合性、review checklist loader の warning 挙動
Core ユーティリティ層 FileComparerTests, FileSystemUtilityTests, PathValidatorTests, ProcessHelperTests, SystemInfoTests, TextSanitizerTests, TextDifferTests, EncodingDetectorTests, ConsoleRenderCoordinatorTests, ConsoleBannerTests ハッシュ/テキスト比較、共有タイムスタンプ書式、パス/ネットワーク判定(// プレフィックスのスラッシュ形式 UNC および IP ベース UNC パスを含む)、コマンド分解、ファイル名/パス整形、コンピュータ名・アプリバージョン取得(SystemInfo)、Myers diff アルゴリズムの正確性(同一/空/追加/削除行、コンテキスト行、ハンクヘッダ、編集距離上限、出力行数切り詰め、大ファイル小差分の効率性)、ファイルエンコーディング自動検出(BOM 付き/なし UTF-8、UTF-16 LE/BE、Shift_JIS、ASCII、空ファイル、日本語テキストのラウンドトリップ)、コンソールレンダーコーディネータのスレッド安全性(RenderSyncRoot、スピナースロットリング、MarkProgressRendered タイミング)、時刻ベース挨拶メッセージの正確性(24時間全カバー、空文字列なし、食事時間帯 "Leave the diff to me" スロット、コーヒーブレイクメッセージの一致)、FolderDiffIL4DotNet.Core に移した再利用 helper の契約確認、TryGetProcessOutputAsync の非ゼロ終了コードでの null 返却・正常コマンド出力・null 引数安全性、SystemInfo.GetComputerName と GetAppVersion の連続呼び出し決定論性
HTML レポート JavaScript diff_report.test.js、diff_report_extended.test.js(Jest/jsdom) formatTs 日付フォーマット、collectState チェックボックス/テキスト/テキストエリア収集とフィルタ ID 除外、autoSave localStorage 永続化とステータス表示、applyFilters Diff Detail/重要度/未チェックのみ/検索フィルタリングと関連 diff-row の非表示(SHA256Match/ILMatch/TextMatch/TextMismatch の Diff Detail フィルタ、diff+importance 複合フィルタを含む)、resetFilters デフォルト状態復元、decodeDiffHtml base64-UTF8 デコード(マルチバイト文字含む)、レビュー状態の encodeEmbeddedState / decodeEmbeddedState による Base64 ラウンドトリップと script-breaking 文字列の安全化、collapseAll details 要素の折りたたみ、clearAll 入力リセットと confirm ガード、DOMContentLoaded 時の __savedState__ および localStorage からの状態復元、レビュー済みモードの読み取り専用化、verifyIntegrity null ガードアラート、setupLazyDiff トグル時の遅延デコード/挿入と重複デコード防止、setupLazySection 遅延セクションのデコードと save イベント接続、forceDecodeLazySections トグルなしの一括デコード、updateProgress のレビュー件数集計(遅延セクションを含む)と破損 localStorage 耐性、esc HTML エスケープ(XSS 防止)、readSavedStateFromStorage エッジケース(不正 JSON、フォールバック、配列)、copyPath クリップボード操作、toggleDiffView サイドバイサイドモード(del+add ペアリング、単独 del/add、ハンクヘッダー、統合ビュー復元)、buildExcelRow セル抽出と短行ガード、キーボードナビゲーション(Escape で details を閉じる)、highlightILCell ディレクティブ/ラベル/型/キーワードのハイライトとプレフィックス保持・ハイライト済み/空セルのスキップ、highlightILDiff ILMismatch 対象指定と TextMismatch スキップ、キーボードナビゲーション(j/k ファイル行フォーカス、x チェックボックストグル、ヘルプオーバーレイ自動表示/自動非表示、Esc テキスト入力 blur と __kbEscHandled__ 連携)、getStoredTheme localStorage 読み取り/エラーハンドリング、highlightAllILDiffs IL ハイライト一括適用と ILMismatch/SHA256Mismatch 識別、wrapInputWithClear コンテナラップ/クリアボタン/has-text トグル/二重ラップ防止、initClearButtons フィルター検索統合、initColResizeSingle リサイズハンドル生成と mousedown/mousemove CSS 変数更新、syncScTableWidths sc-detail/dc-detail 幅計算、syncFilterRowHeight 要素不在時の安全な no-op、フィルターゾーン折りたたみ状態の永続化と reviewed モードの localStorage 分離、initVirtualScroll 閾値判定(100行以下スキップ/超過で有効化)・ビューポートラップ・行数インジケーター・部分レンダリング、vsRender 冪等再レンダリングと null ガード、vsRefreshVisibility 重要度ベースの行フィルタリングとインジケーター更新、vsMaterializeAll 完全 DOM 復元とビューポートアンラップ、buildExcelFramework ヘッダー/凡例/セクション/サマリー/警告の組み立て、downloadExcelCompatibleHtml 小規模レポートの即時パス、downloadExcelImmediate Blob ダウンロードとファイル名、downloadAsPdf 印刷ヘッダー/フッター注入と afterprint クリーンアップ、downloadReviewed SHA256 整合性埋め込み付きレビュー済み HTML 生成と安全な state export、setupLazyIntersectionObserver オブザーバー生成/API 不在時耐性/交差コールバック、キーボード IME フォールバック(Process キーと KeyJ/KeyK/KeyX コードマッピング)、Escape キーボードフォーカス解除、toggleAllInSection メインテーブルヘッダーの全チェック/全チェック解除、toggleAllInDetailTable 詳細テーブルの全チェック/全チェック解除(非仮想スクロールおよび仮想スクロールの rowData.cbChecked 更新)、syncHeaderCheckboxes の indeterminate/checked 状態(メインテーブル、rowData ベースカウントの仮想スクロール詳細テーブル)、collectState 仮想スクロール非 DOM エントリの含有
アーキテクチャ境界 CoreSeparationTests, CiAutomationConfigurationTests, MutationSummaryScriptTests, MutationPrCommentScriptTests utility 型が FolderDiffIL4DotNet.Core アセンブリに残り、実行ファイル側へ旧 FolderDiffIL4DotNet.Utils 名前空間が戻らないこと、カバレッジゲート、リリースワークフロー、CodeQL、Dependabot、ベンチマークリグレッションワークフローの設定が維持されること、切り出した scripts/generate-mutation-summary.py の entry point と best-effort PR コメント防御が workflow に配線され続けること、summary script が stryker-config.json から閾値を読むこと、ドキュメントのカバレッジ閾値が CI ワークフローと一致すること、ベンチマークリグレッションワークフローが期待構造(PR トリガー、benchmark-action、閾値、fail-on-alert)を含むこと、さらに mutation-summary script 自体が正常系・0 mutant・破損レポート・レポート欠落系の fixture で実行検証され、PR コメント helper は bot 所有コメントだけを対象にした update/create の upsert 経路まで検証すること
Git テスト分離 TestGitRepositoryTests 一時 Git リポジトリが単一の共通初期化経路を使い、ユーザー/システム Git 設定を読み込まず、commit/tag 署名と hook をローカルで無効化して非対話実行すること、擬似グローバル設定ファイルを変更しないこと、分離済みグローバル設定で署名を有効化しても commit と annotated tag を作成できること
プラグインシステム PluginLoaderTests, FileDiffServiceUnitTests.Hooks, DotNetDisassemblerProviderTests, PluginConfigSettingsTests, ReportFormatterTests, ReportSectionWriterOrderTests サーチパスからのプラグイン読み込み(存在しないパス、空ディレクトリ、無効な DLL、同一プラグイン DLL の重複サーチパス抑止、コンストラクタ null ガード、trusted hash 未設定/空/不一致時の strict mode 事前ハッシュ拒否)、IFileComparisonHook の before/after 統合(フックオーバーライド、null パススルー、例外処理、フェーズ付き失敗ログと hook order、マルチフック順序付け)、DotNetDisassemblerProvider の .NET/非 .NET ファイル向け CanHandle、recoverable な判定失敗時の DisplayName/拡張子付き warning、DisassembleAsync 委譲とエラー処理、プラグイン設定のラウンドトリップ(PluginSearchPaths、PluginEnabledIds、PluginConfig JSON シリアライズ、読取専用保証)、IReportFormatter の Order 値と IsEnabled 条件、IReportSectionWriter 組み込みライター数と一意/昇順 Order 不変条件
Runner 層 CliOverrideApplierTests、DiffPipelineExecutorTests、DryRunExecutorTests、RunScopeBuilderTests、PluginAssemblyLoadContextTests、SpinnerThemesTests CLI オーバーライド適用(--threads、--no-il-cache、--skip-il、--no-timestamp-warnings のビルダーへの反映、デフォルトオプションはビルダーを変更しないこと)、FormatElapsedTime フォーマット(ゼロ、秒未満、複数時間)、DiffPipelineResult レコード等価性(HasILFilterWarnings フィールドを含む)、コンストラクタ null ガード、RunScopeBuilder.BuildExecutionContext ネットワーク検出とパス保存、CreateIlCache 条件付き生成、DI コンテナサービス解決、PluginAssemblyLoadContext コレクティブルコンテキスト生成と共有アセンブリフォールバック、ポストプロセスアクション失敗が best-effort のまま継続されつつ Warning ログにアクション型と例外型が残ること、非表示のスピナーイースターエッグ互換動作
セクションライター個別 HeaderSectionWriterTests、LegendSectionWriterTests、ConditionalSectionWriterTests、FileListSectionWriterTests、SummarySectionWriterTests、IgnoredFilesSectionWriterTests、ILCacheStatsSectionWriterTests、WarningsSectionWriterTests ライターごとの Order 値、IsEnabled 条件(IgnoredFiles 設定フラグ、UnchangedFiles 設定フラグ、ILCacheStats 設定+キャッシュ null、Warnings SHA256 不一致/タイムスタンプ後退/IL 部分文字列設定の安全性)、Write 出力内容アサーション(レポートタイトル、アプリバージョン、パス、コンピュータ名、凡例 SHA256、Added/Removed/Modified/Unchanged セクションヘッダ、サマリー経過時間、警告キーワード、IL 部分文字列設定の安全性警告テキスト)、空/ゼロカウント結果リスト処理、Ignored 空リスト時の早期リターン、ILCacheStats キャッシュ null 時の無効化
プラグインアンロード/クリーンアップ PluginUnloadCleanupTests コレクティブル AssemblyLoadContext のアンロード(クリーンアンロード、アセンブリ読み込み後のアンロード、複数コンテキストの独立アンロード)、WeakReference によるアンロード後 GC 回収検証、二重アンロード InvalidOperationException、Unloading イベント発火、共有 Plugin.Abstractions アセンブリのプラグインアンロード後存続
セキュリティ(XSS/パストラバーサル) HtmlReportSecurityTests、PathTraversalSecurityTests HtmlEncode XSS 防止(script タグ、属性インジェクション、テンプレートリテラルのバックティック、二重エンコード、制御文字、CJK テキスト透過、悪意あるファイルパス、HTML 特殊文字 5 種、null/空文字列)、PathValidator トラバーサル防止(相対パスエスケープ、dot/dotdot、NULL バイト/制御文字、Windows 予約名、末尾スペース/ドット、絶対パス、Unicode 受入、極端なパス長)
ネットワーク共有最適化 NetworkPathDetectorTests NetworkPathDetector.IsLikelyNetworkPath UNC 検出(バックスラッシュ、フォワードスラッシュ、デバイスパス形式)、null/空/空白の拒否、ローカルパス拒否。同一ファイル内で DiffExecutionContext のネットワークフラグ伝播(OptimizeForNetworkShares、DetectedNetworkOld/New)、null パス ArgumentNullException、IL 出力パス導出も検証
プロパティベーステスト PropertyBasedTests FsCheck によるプロパティベーステスト: TextDiffer のコンテキスト行範囲、同一入力で変更なし、パッチ再構築、最大出力行数上限; TextSanitizer の冪等性、出力にパス区切りなし、空/null 安全性; FileDiffResultLists の統計合計不変条件; ConfigSettings の MaxParallelism クランプとデフォルト正値
HTML レポート構造回帰 HtmlReportVisualRegressionTests 生成 HTML の 22 個の構造不変条件: DOCTYPE、charset、CSP メタタグ、style/script ブロック、全レポートセクション(Added/Removed/Modified/Unchanged)、<!--CTRL--> マーカー、チェックボックス、テキスト入力、フィルタコントロール、ダウンロードボタン、ダークモード CSS、キーボードショートカット JS、localStorage JS、SHA256 整合性 JS、セレブレーションアニメーション、Excel エクスポート、テーマ切替、data-section/data-importance 属性、シードされたファイルパス、バージョン/コンピュータ名埋め込み、外部リソース参照なし、実行間の決定的出力
パフォーマンスバジェット PerformanceBudgetTests 粗いパフォーマンスガードレール(マイクロベンチマークではない): TextDiffer の 5 万同一行 < 500ms、TextDiffer の 1 万行・20 箇所変更 < 2000ms、TextSanitizer の 10 万回反復 < 500ms、FileDiffResultLists SummaryStatistics の 1 万ファイル・1000 回反復 < 100ms

| JS/CSS ミニファイ | JsMinifierTests | Minify JS コメント除去(末尾コメント、コメントのみの行、空行除去)、文字列リテラル保持(シングルクォート内 // URL、ダブルクォート内 // URL、文字列内エスケープ引用符、混在引用符ネスト)、downloadReviewed() パターン用の空白保持、null/空/空白のみの入力処理、MinifyCss ブロックコメント除去、重要コメント(/*! ... */)保持、未終端コメントの安全な処理、CSS 空白保持 | | 例外フィルタ | ExceptionFiltersTests | IsFileIoRecoverable true/false マトリクス(IOException、UnauthorizedAccessException、NotSupportedException → true、InvalidOperationException、NullReferenceException、ArgumentException → false、FileNotFoundException サブクラス → true)、IsFileIoOrOperationRecoverable(InvalidOperationException 包含)、IsPathOrFileIoRecoverable(ArgumentException/ArgumentNullException 包含、InvalidOperationException 除外)、IsProcessExecutionRecoverable(Win32Exception 包含、ArgumentException 除外) | | パス形状診断 | PathShapeDiagnosticsTests | DescribeRootedState は null/空文字/空白/埋め込み NUL で Unknown、相対パスで False、絶対パスで True;LooksLikePath は null/空/埋め込み NUL/裸のコマンド名で false、forward slash / プラットフォームのディレクトリ区切り / 絶対パスで true;DescribeState は <Label>IsPathRooted= と <Label>LooksPathLike= の断片を組み立て、不正入力では例外を出さずに Unknown/False にダウングレードする。監査ログ、SBOM、レポート出力、キャッシュ層、逆アセンブラ起動、logger cleanup、プリフライト、プラグインローダ、open-folder、IL テキスト出力で共有される診断 helper を pin する。 | | アセンブリ SDK バージョン | AssemblySdkVersionReaderTests | FormatTargetFramework 変換(.NETCoreApp → .NET、.NETFramework → .NET Framework、.NETStandard → .NET Standard、不明フレームワーク、カンマなし生値、v プレフィックスなしの Version= フォールバック)、ReadTargetFramework 実アセンブリ抽出、存在しないファイルの null 返却、非アセンブリファイルの null 返却、空ファイルの null 返却、ReadPairDisplayString 同一バージョン単一文字列、両方 null 返却、片方 null フォールバック | | タイムスタンプキャッシュ | TimestampCacheTests | GetOrAdd キャッシュヒット/ミス(2 回目の呼び出しは同一値を返す)、null/空の ArgumentException、Clear 無効化(クリア後にファイルタイムスタンプ変更を検出)、大文字小文字を区別しないキーマッチング |

テスタビリティに関する構成:

  • IL順序の回帰テストでは、実際的なclass階層と dotnet-ildasm/ilspycmd 両方のmethodシグネチャ配置を使います。同じ通常親class内のmethod並び替えだけを許容し、interface/importの直接member順変更、method本体の変更、異なるシグネチャ間での本体入れ替え、class間移動、複数行class headerのidentity衝突、複数行 marshal({ ... }) header境界は差分のままであることを検証します。
  • ProgramTests は薄い Program.Main を対象にし、ProgramRunnerTests は ProgramRunner 内のフェーズ順序と型付き終了コード分類を固定します。これにより、引数検証より先に設定読込へ進んでしまう回帰や、異なる失敗理由が再び同じ終了コードへ潰れる回帰を防ぎつつ、静的状態への結合を減らしています。
  • 差分パイプラインの主要サービスは IFileDiffService, IILOutputService, IFolderDiffService, IDotNetDisassembleService, IILTextOutputService の差し替えポイントを持ちます。
  • FolderDiffExecutionStrategy と FolderDiffService は IFileSystemService を受け取れるため、ユニットテストでは実ファイルを作らずに列挙失敗・EnumerateFiles(...) ベースの遅延列挙・無視ファイル記録・出力先 I/O 失敗・大量ファイル入力を再現できます。
  • FileDiffService は IFileComparisonService も受け取れるため、ユニットテストでは実ファイルを作らずにハッシュ権限エラー・IL 出力失敗・大きいテキスト比較のチャンク読み出しを再現できます。
  • DiffExecutionContext が実行単位のパスやネットワークモードを保持するため、テストセットアップで共有グローバル状態を書き換える必要がありません。
  • Core helper のテストは FolderDiffIL4DotNet.Tests/Core/ へまとめ、CoreSeparationTests でアセンブリ境界も固定しています。これにより、再利用 helper が再び実行ファイル側へ混ざる回帰を防ぎます。
  • CiAutomationConfigurationTests は、コミット済みの GitHub 設定ファイルを直接読んで検証します。これにより、カバレッジゲート、タグ起点のリリース自動化、CodeQL、Dependabot を外す変更は、同じ差分でテスト更新が必要になります。
  • AssemblyMethodAnalyzer と DotNetDisassembleService は partial class ファイルに分割されています(DEVELOPER_GUIDE.md § Partial Class ファイル構成を参照)。FileDiffResultLists も partial ファイルに分割されています(FileDiffResultLists.ComparisonResults.cs、FileDiffResultLists.Metadata.cs)。既存テストは同一の公開 API を検証しており、partial class 分割に伴う新規テストファイルの追加は不要です。
  • 大規模テストクラスも保守性のため partial class ファイルに分割されています(約 500 行/ファイルガイドライン): ChangeImportanceClassifierTests(2 ファイル)、ProgramRunnerTests(6 ファイル)、HtmlReportGenerateServiceTests(7 ファイル)、FileDiffServiceUnitTests(6 ファイル)、ReportGenerateServiceTests(6 ファイル)、FolderDiffServiceUnitTests(2 ファイル)、ILCacheTests(2 ファイル)、DepsJsonAnalyzerTests(2 ファイル)、DotNetDisassembleServiceTests(2 ファイル)、ConfigSettingsTests(4 ファイル)、FileDiffResultListsTests(2 ファイル)。クラス名・名前空間は変更なし — ファイル配置のみが異なります。
  • TestLogger は ILoggerService を実装した共有テストヘルパーで、ログエントリのキャプチャに使用します。テストクラスごとの重複定義を統合し、オプションのコールバックフック、設定可能な LogFileAbsolutePath、および TestLoggerTests で検証されたスレッドセーフな並行キャプチャをサポートします。
  • FolderDiffExecutionStrategyTests、FolderDiffServiceUnitTests、FileDiffServiceUnitTests には Trait("Category", "Unit")、実ディレクトリを使う FolderDiffServiceTests と FileDiffServiceTests には Trait("Category", "Integration")、実逆アセンブラを使う RealDisassemblerE2ETests には Trait("Category", "E2E") を付け、境界を明示しています。今回の unit 追加では、IL 事前計算のバッチ化、テキスト比較メモリ予算フォールバック、シンボリックリンクループ列挙エラー、比較前ファイル削除の分類、逆アセンブラ ブラックリスト TTL 境界、// プレフィックス UNC 検出、DiffSummaryStatistics/SummaryStatistics のスナップショット正確性、レポートセクションでの Unicode ファイル名ラウンドトリップ、10,500 件の大件数サマリー統計、高競合下でのブラックリスト並行アクセスも固定しています。

変更種別ごとの出発点:

ローカルでのテスト実行

全テスト実行:

dotnet test FolderDiffIL4DotNet.Tests/FolderDiffIL4DotNet.Tests.csproj --configuration Release --nologo -p:UseAppHost=false

カバレッジ付き実行(Cobertura XML + opencover、.runsettings 使用):

dotnet test FolderDiffIL4DotNet.Tests/FolderDiffIL4DotNet.Tests.csproj --configuration Release --nologo -p:UseAppHost=false --settings coverlet.runsettings --collect:"XPlat Code Coverage" --results-directory ./TestResults

クラス単位実行:

dotnet test FolderDiffIL4DotNet.Tests/FolderDiffIL4DotNet.Tests.csproj --configuration Release --nologo -p:UseAppHost=false --filter "FullyQualifiedName~FolderDiffIL4DotNet.Tests.Services.FolderDiffServiceTests"

メソッド単位実行:

dotnet test FolderDiffIL4DotNet.Tests/FolderDiffIL4DotNet.Tests.csproj --configuration Release --nologo -p:UseAppHost=false --filter "FullyQualifiedName~Main_WithValidArguments_ReturnsSuccessAndGeneratesReport"

FolderDiffService の軽量ユニットテストだけを回す場合:

dotnet test FolderDiffIL4DotNet.Tests/FolderDiffIL4DotNet.Tests.csproj --configuration Release --nologo -p:UseAppHost=false --filter "Category=Unit"

実ディレクトリを使う統合テストだけを回す場合:

dotnet test FolderDiffIL4DotNet.Tests/FolderDiffIL4DotNet.Tests.csproj --configuration Release --nologo -p:UseAppHost=false --filter "Category=Integration"

実逆アセンブラの E2E テストだけを回す場合(FOLDERDIFF_RUN_E2E=true が必要):

FOLDERDIFF_RUN_E2E=true dotnet test FolderDiffIL4DotNet.Tests/FolderDiffIL4DotNet.Tests.csproj --configuration Release --nologo -p:UseAppHost=false --filter "Category=E2E"

HTML レポートの JavaScript 全テストと CI 同等の npm 監査ゲートを実行する場合(.node-version の Node.js 24.18.0 を使用):

npm ci
npm run test:js
npm run audit:high

監査ゲートは、npm-audit-exceptions.json に完全一致かつ期限付きで記録した項目を除き、High/Critical advisory をすべて失敗させます。現在有効な npm 監査例外はなく、ロック済み Jest 依存グラフでは package.json の overrides により修正版 brace-expansion を選択します。将来追加する例外が開発用依存関係だけに限定されることは、別の --omit=dev 監査で強制します。scripts/npm-audit-gate.js は、例外が期限切れの場合や npm audit から有効なレポートを取得できない場合も失敗します。

NuGet 監査ゲートのテストと、CI と同じソリューション全体の直接・推移的依存関係監査を実行する場合:

python3 -m unittest discover -s scripts/tests -p 'test_*.py'
python3 scripts/nuget_audit_gate.py --solution FolderDiffIL4DotNet.sln

scripts/nuget_audit_gate.py は dotnet list FolderDiffIL4DotNet.sln package --vulnerable --include-transitive --format json --output-version 1 --source https://api.nuget.org/v3/index.json を実行し、報告された advisory をすべて表示します。利用可能な場合は GitHub job summary にも結果を書き込み、直接・推移的依存関係の High/Critical 検出を失敗させます。advisory 対応の nuget.org source を明示的に必須とし、コマンドや JSON レポートが不正・不完全な場合も fail-closed で失敗します。現在有効な NuGet 監査例外はありません。将来一時例外を提案する場合は、CI ポリシーを変更する前に advisory、理由、正確な依存関係/project の範囲、失効日を記録する必要があります。

パフォーマンスベンチマーク(BenchmarkDotNet)を実行する場合:

dotnet run -c Release --project FolderDiffIL4DotNet.Benchmarks

# 特定のベンチマーククラスだけを実行
dotnet run -c Release --project FolderDiffIL4DotNet.Benchmarks -- --filter *TextDiffer*

benchmark CI ジョブ(workflow_dispatch のみ)はすべてのベンチマークを JSON および GitHub エクスポーター付きで実行し、BenchmarkDotNet.Artifacts/ を CI アーティファクトとしてアップロードします。benchmark-regression ワークフロー(.github/workflows/benchmark-regression.yml)は main への PR で自動実行されます。scripts/check_benchmark_regressions.py が互換履歴の中央値と benchmark-regression-policy.json の実測ベースなグループ別 warning/failure 上限を使用します。制御された Python fixture で中央値計算、正確な閾値境界、意図した base の祖先判定、warmup/reset、定義不一致、環境ごとの分離、ホスト情報の欠落・混在拒否、レポート結合、意図的 baseline 公開を検証します。上記の python3 -m unittest discover コマンドで実行できます。

CI 同等コマンド(GitHub Actions と同じ test ステップ):

FOLDERDIFF_RUN_E2E=true DOTNET_ROLL_FORWARD=Major dotnet test FolderDiffIL4DotNet.Tests/FolderDiffIL4DotNet.Tests.csproj --configuration Release --no-build --nologo --settings coverlet.runsettings --logger "trx;LogFileName=test_results.trx" --collect:"XPlat Code Coverage" --results-directory ./TestResults

ミューテーションテスト実行(Stryker.NET):

dotnet tool restore
dotnet tool run dotnet-stryker --config-file stryker-config.json --output StrykerOutput

ローカル実行では HTML/JSON レポートが StrykerOutput/**/reports/ に出力されます。CI では同じ出力先を使い、mutation-summary.md を GitHub Actions のジョブサマリに追記し、run ごとの StrykerSummary-* / StrykerReport-* artifact を保存し、同一リポジトリ由来の pull request には同じ内容を sticky bot コメントとして投稿します。PR コメント step は best-effort なので、GitHub コメント API 側の失敗で mutation gate 自体は落ちません。Actions の run 履歴と各 run の artifact 群を、ミューテーションスコア推移の正本として扱ってください。 切り出した helper script 群は、Python 3.10+ 専用構文や新しすぎる Node 専用構文を避けています。これにより workflow とローカルの architecture テストは、従来どおり素の python3 / node 起動で動かせます。npm/Jest のサプライチェーンジョブは、別途 .node-version でバージョンを固定します。

カバレッジレポート

カバレッジ付き実行後、TestResults/**/coverage.cobertura.xml が生成されます。

カバレッジ値はコードとテストの変化に応じて変動します。現時点の値が必要な場合はローカルでレポートを再生成し、しきい値の強制は CI を正本として扱ってください。 CI では total の最小値として、行 80% / 分岐 75% を下回ると失敗します。 さらに、コア差分クラス(FileDiffService、FolderDiffService、FileComparisonService)にはクラス単位で行 85% / 分岐 65% のベースライン下限が適用されます。

ローカルで要約を作る場合(ローカルツールマニフェストを使用):

dotnet tool restore
dotnet tool run reportgenerator -reports:"TestResults/**/coverage.cobertura.xml" -targetdir:"CoverageReport" -reporttypes:"MarkdownSummaryGithub;Cobertura;HtmlInline_AzurePipelines"

coverlet.runsettings の設定内容:

  • Include/Exclude フィルタ: [nildiff]* と [FolderDiffIL4DotNet.Core]* アセンブリのみ計測対象。テストおよびベンチマークアセンブリは除外。
  • 属性除外: [ExcludeFromCodeCoverage]、[GeneratedCode]、[CompilerGenerated]、[Obsolete] 属性付きメンバーを除外。
  • 出力フォーマット: cobertura(CI 閾値チェック用)と opencover(IDE 詳細分析用)の両方を生成。
  • 決定論的レポート: DeterministicReport=true で CI 実行間の再現性を確保。

CI 連携メモ

ワークフロー/設定: .github/workflows/dotnet.yml, .github/workflows/release.yml, .github/workflows/codeql.yml, .github/dependabot.yml

  • テスト前に DocFX サイト生成を実行し、_site/ を DocumentationSite artifact として公開します。
  • FolderDiffIL4DotNet.Tests/FolderDiffIL4DotNet.Tests.csproj が存在する場合のみテスト/カバレッジを実行します。
  • .NET の検証は 3 つのブロッキングジョブで構成されます。build ジョブ(Ubuntu)はテスト前に実 dotnet-ildasm をインストールし、グローバルツールディレクトリを PATH に追加したうえで、DOTNET_ROLL_FORWARD=Major と FOLDERDIFF_RUN_E2E=true 付きでテストを実行します。test-windows ジョブ(Windows)も windows-latest 上で同様に検証します。
  • test-macos ジョブは、ワークフローで設定されたすべての pull request、対象ブランチへの push、手動実行に対して macos-latest 上で動きます。Release ビルドと安定テストを実行し、生成した apphost を直接起動します。CLI スモークでは実行権限、--doctor によるツール探索、一時領域上の空白と大文字小文字差を含む POSIX パス、レポート生成、差分検出時の想定終了コード 5 を確認します。
  • macOS で除外するのは、外部逆アセンブラの hosted runner 上での安定性が未確認である E2E と、共有 hosted runner で時間判定に適さない Performance だけです。パス/大文字小文字処理、一時ディレクトリ、決定的な偽ツール探索の unit テストは引き続き実行します。ジョブレベルの条件や continue-on-error はないためブロッキングであり、20 分のタイムアウトと 2 つの限定的な除外でコストを抑えます。macOS の実逆アセンブラ E2E は hosted runner 上での安定性を確認できるまで延期します。
  • ブロッキングな javascript-tests ジョブは、.node-version の Node.js バージョンを厳密に使い、package-lock.json をキーに npm キャッシュを構成し、npm ci で復元して Jest 全件を実行します。さらに npm run audit:high により、新しく持ち込まれた High/Critical の npm advisory で失敗します。このゲートが許可するのは、npm-audit-exceptions.json の未失効かつ完全一致する advisory を起点とした依存チェーンだけであり、無関係な検出、期限切れの例外、無効な監査レスポンスは CI を失敗させます。
  • TestAndCoverage アーティファクトに TRX とカバレッジ関連ファイルを格納します。
  • CoverageReport/SummaryGithub.md があれば GitHub Step Summary に追記されます。
  • 専用のしきい値チェックで coverage.cobertura.xml を解析し、total 行 80% / 分岐 75% を下回るとワークフローを失敗させます。同ステップでコア差分クラス(FileDiffService、FolderDiffService、FileComparisonService)のクラス単位ベースライン下限(行 85% / 分岐 65%)も強制します。
  • mutation-testing ジョブは StrykerOutput/mutation-summary.md と mutation-summary.json を生成し、その markdown を GitHub Step Summary に追記したうえで、run ごとの StrykerSummary-* / StrykerReport-* artifact をアップロードし、同一リポジトリ由来の pull request には同じ要約を sticky PR コメントとして反映します。
  • 切り出した scripts/generate-mutation-summary.py helper は architecture テストから直接実行されるため、score 抽出・0 mutant の valid summary・survivor 集計・レポート欠落/破損時フォールバックの崩れを GitHub Actions 実行前に検知できます。
  • 切り出した scripts/update-mutation-pr-comment.js helper も architecture テストで直接検証し、sticky PR コメント更新が bot 所有の marker コメントだけに限定されることを固定しています。
  • .github/workflows/release.yml は v* タグで実行し、再ビルド/再テスト/publish 後に publish 出力とドキュメントをアーカイブし、push されたタグから GitHub Release を作成します。
  • .github/workflows/codeql.yml は csharp と actions に対する CodeQL をコード変更時と週次で実行します。Nerdbank.GitVersioning 向けに Checkout で fetch-depth: 0 を指定し、Default Setup との競合を吸収するため Analyze ステップに continue-on-error: true を設定しています。
  • .github/dependabot.yml は NuGet、GitHub Actions、npm の更新 PR を週次で有効化します。npm の PR も他の pull request と同じ javascript-tests ゲートを通ります。
  • CiAutomationConfigurationTests が、これらの設定ファイルも回帰テスト対象に含めます。
  • "Validate test scope map" ステップが scripts/validate-test-scope-map.py を実行し、すべてのテストクラスファイルがこのガイドの範囲マップテーブルにリストされていることを検証します。このステップは非ブロッキング(continue-on-error: true)ですが、新規テストクラスが文書化されていない場合に警告を出力します。

テスト分離と実行環境の注意

  • 多くのテストは Path.GetTempPath() 配下に一意ディレクトリを作成し、Dispose/finally で後始末します。
  • Git を使うテストは TestGitRepository 経由でリポジトリを作成してください。テスト専用のグローバル/システム設定を使い、継承されたリポジトリ・識別情報の環境変数を除去し、commit/tag 署名と hook をローカルで無効化して、ユーザー設定を変更せず Git を非対話実行します。
  • ProgramTests は AppContext.BaseDirectory 配下の config.json を一時書き換えし、必ず復元します。
  • DotNetDisassembleServiceTests は PATH/HOME を一時変更し、擬似ツールスクリプトでフォールバック/ブラックリスト挙動を決定的に検証します。バージョンキャッシュに特定バージョンを事前投入するテストは、GetVersionWithFallbacksAsync が実ツールより先に擬似ツールを解決できるよう、同じバージョンを返す偽スクリプトも PATH に追加する必要があります(CI ランナーに実ツールがインストールされているため、追加しないとキャッシュ投入値が上書きされます)。
  • RealDisassemblerE2ETests は temp ディレクトリ上に一時クラスライブラリをビルドし、dotnet-ildasm 固定で E2E 検証します。CI では dotnet-ildasm のインストール、グローバルツールディレクトリの PATH 追加、DOTNET_ROLL_FORWARD=Major、FOLDERDIFF_RUN_E2E=true によりこの前提を満たします。
  • 逆アセンブラ関連の一部テストは Windows では [SkippableFact] + Skip.If(OperatingSystem.IsWindows(), ...) によりスキップされます。これにより、テストが「成功」扱いで素通りするのではなく、テストランナー上で**Skipped(スキップ)**として明示的に報告されます。RealDisassemblerE2ETests は E2E opt-in がない場合のみスキップされ、FOLDERDIFF_RUN_E2E=true のときに dotnet-ildasm が使えなければスキップではなく失敗します。
  • 多くの単体テストは実ツールのグローバルインストールを不要とします(テストダブル利用)。
  • 静的な可変テストフックは追加せず、実行単位の値はコンストラクタ注入と DiffExecutionContext で渡してください。
  • テストプロジェクトでは <Nullable>enable</Nullable> を有効にし、CS8603(null 参照を返す可能性)を強制しています。nullable 警告(CS8600、CS8604、CS8605、CS8618、CS8619、CS8620、CS8625)および xUnit1012 は引き続き .csproj の <NoWarn> で抑制しています。残る抑制は、引数バリデーション、null ガード分岐、エラー時の正常動作を検証するために意図的に null を渡すテストコードを含みます。各呼び出し箇所の意図をアノテーションで明示しながら段階的に削除してください。

テスト追加・更新時の方針

  • 非決定要因(ネットワーク、時刻依存、グローバル状態依存)を避けて決定的に保ってください。
  • テストごとに一意の一時ディレクトリを使って干渉を防いでください。
  • 変更した環境変数や一時設定ファイルは必ず復元してください。
  • 内部実装より、分類結果・レポート内容・ログ副作用など観測可能な振る舞いを優先して検証してください。
  • テストプロジェクトの場所/名称を変更した場合は .github/workflows/dotnet.yml の条件とコマンド、および CiAutomationConfigurationTests の検証内容を更新してください。
  • リリースまたはセキュリティ自動化を変える場合は、.github/workflows/release.yml、.github/workflows/codeql.yml、.github/dependabot.yml、CiAutomationConfigurationTests を同じ差分で更新してください。
  • public API を変更した場合は、DocFX サイトを再生成し、XML コメントが新しいメンバーを正しく説明しているか確認してください。
  • ユーザーから見える実行挙動が変わった場合は、README.md、USER_GUIDE.md、doc/DEVELOPER_GUIDE.md も同じ変更で更新してください。
  • 実行ライフサイクルやサービス境界を変えた場合は、テスト名や説明に使っている用語も開発者ガイドと揃っているか確認してください。