xUnit has specific behaviors that affect how Stryker performs mutation testing:
Conflicting Test Cases
If multiple xUnit test cases share the same Guid (identifier), xUnit will report results for all of them under that single VsTest test case.
Ignored Tests
Tests marked as ignored in xUnit are completely ignored by the runner and are not reported to Stryker.
Theories (Parameterized Tests)
- Static Theories (
InlineData): These are processed as distinct test cases unless they share identical parameters. - Run-time Theories: These may be discovered as a single test. During discovery, xUnit attempts to map data sets to test cases. If it cannot create unique display names, it may provide multiple results for the same test case.
Execution Sequence and Risks
- Discovery: xUnit discovers all tests at startup. If a specific list is provided, it filters them. Note that requested tests not found during discovery will not be reported.
- Execution: xUnit runs all data sets for a theory, then reports results.
Critical Risks for Stryker:
- Coverage Spillage: Because Stryker captures coverage on
testcase end, coverage from one test might be incorrectly associated with the next test if it occurs between the end and start events. - Isolation Issues: If a mutation changes a test's name (e.g., via
ToString()), the identifier changes. This prevents the test from being run in isolation via Stryker, as Stryker can no longer predict the new name.
TestSession start event
xUnit discovers test
xUnit discovers theories
xUnit enumerates data source (for tests)
...
TestCase start event
xUnit runs test with first set of data
xUnit runs test with second set of data
...
xUnit runs test with last set of data
xUnit reports first test results
TestCase end event
xUnit reports second test result
...
xUnit reports last test result
TestCase start event
...
TestSession end event