How stryker-mutator/stryker-net works
Project type and purpose
• This is a CLI-based mutation testing tool (stryker.NET) for .NET Core/Framework projects.
• Key responsibilities: read user config, analyze & mutate source code, run tests, collect coverage, apply filters, and generate mutation reports (HTML/JSON/CLI).
File structure
• Top-level modules under src:
– Stryker.CLI: the entry point and command-line interface
– Stryker.Core: the mutation testing engine
– Stryker.Abstractions: interfaces & shared types (dependency inversion)
– Stryker.TestRunner.VsTest & Stryker.TestRunner: adapters for running tests via VSTest
– Stryker.DataCollector: coverage collection logic
– Stryker.Options: configuration definitions & validation
– Stryker.RegexMutators: regex-specific mutators plugin
– Stryker.Utilities: shared helpers (MSBuild, Roslyn, logging, file utils)
• Each module has its own unit tests under corresponding *.UnitTest folders.
• Build logic and packaging via Directory.Build.* props & targets.
• Documentation and example projects under docs/ and ExampleProjects/.
Additional insights from README
• dotnet global tool (dotnet-stryker) – invoked from shell
• Target runtimes: .NET Core, .NET Framework, .NET Standard
• Outputs interactive HTML report, CLI summary, JSON for dashboard
• Supports baseline comparison (Azure/Dashboard/Disk)
Main components & interactions
1. CLI Layer (Stryker.CLI)
2. Configuration (Stryker.Options + file readers)
3. Core Engine (Stryker.Core)
– Initialization
– Compilation (Roslyn via Utilities)
– Mutation Generation (Mutators, InjectedHelpers, Instrumentation)
– Mutation Filters & Orchestration
– Mutation Test Execution
4. Test Runner Adapter (Stryker.TestRunner.VsTest & Stryker.TestRunner)
5. Coverage Collector (Stryker.DataCollector)
6. Reporters (HTML, JSON, Console)
7. Abstractions (interfaces for injection & extension)
8. External Services
– MSBuild / NuGet Restore
– Visual Studio Test Platform (VSTest)
– Dashboard API (optional baseline)
• CLI → Configuration builder → Core Engine start
• Core Engine → MSBuild/NuGet (via Utilities) → compile original code
• Core Engine → Mutation Generator → produce mutated assemblies
• For each mutant:
– Core Engine → Test Runner → execute tests (via VsTestAdapter)
– Test Runner → Coverage Collector (for coverage mode)
• Core Engine → Filters → determine killed/survived mutants
• Core Engine → Reporters → HTML/JSON/Console output
• Optionally: Core Engine → Dashboard client (via Abstractions)
c. Architectural patterns & principles
• Layered architecture: CLI → Core → Test Runner → Reporters
• Dependency inversion: all implementations depend on Stryker.Abstractions interfaces
• Plugin-like mutator design: new mutators (CSharp, Regex) extend base Mutator classes
• Factory & Strategy for BaselineProviders, DiffProviders, MutantFilters
d. Relevant technologies
• .NET Core/.NET Framework CLI tool
• Roslyn for compilation & syntax tree mutation
• MSBuild APIs for project analysis
• VSTest platform for test execution
• SSE for real-time HTML reporting
• HTTP client for Dashboard upload