chore: Add test information to mtp result for reporting#3541
chore: Add test information to mtp result for reporting#3541richardwerkman wants to merge 3 commits intomasterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR enhances the Microsoft Testing Platform (MTP) test runner integration so discovered tests carry source-location metadata (file/line/type/method), enabling more accurate downstream test reporting in Stryker.
Changes:
- Extend the MTP
TestNodemodel to deserialize location metadata (file/line/type/method) from MTP JSON payloads. - Populate
MtpTestCasewithCodeFilePath,LineNumber, and a derivedFullyQualifiedName. - Add unit tests covering location deserialization and
MtpTestCasemapping; update.github/copilot-instructions.mdcontent/structure.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/Stryker.TestRunner.MicrosoftTestPlatform/Models/TestNode.cs |
Adds optional location fields mapped to MTP JSON property names. |
src/Stryker.TestRunner.MicrosoftTestPlatform/Models/MtpTestCase.cs |
Maps TestNode location data onto ITestCase fields used for reporting. |
src/Stryker.TestRunner.MicrosoftTestPlatform.UnitTest/MtpTestCaseTests.cs |
Adds tests for the new location mapping and JSON deserialization behavior. |
.github/copilot-instructions.md |
Expands project overview and updates contributor guidance (but introduces a duplicate heading). |
| _testNode = testNode; | ||
| CodeFilePath = testNode.LocationFile ?? string.Empty; | ||
| LineNumber = testNode.LocationLineStart ?? 0; | ||
| FullyQualifiedName = BuildFullyQualifiedName(testNode); |
| CodeFilePath = testNode.LocationFile ?? string.Empty; | ||
| LineNumber = testNode.LocationLineStart ?? 0; |
| public void MtpTestCase_WithoutLocationType_FallsBackToUid() | ||
| { | ||
| var testNode = new TestNode("uid-1", "TestMethod1", "action", "discovered", | ||
| LocationFile: "/path/to/TestFile.cs", | ||
| LocationLineStart: 10); | ||
|
|
| ## Adding a mutator | ||
|
|
|
|
||
| ### Running Stryker on itself | ||
|
|
||
| Running Stryker on itself doesn't work as assemblies will be in use. To run Stryker on the stryker codebase, use the official nuget release via `dotnet tool install dotnet-stryker` and then `dotnet stryker`. |
There was a problem hiding this comment.
Should work with the Stryker on Stryker script
|
There was a problem hiding this comment.
Pull request overview
This PR improves Microsoft Testing Platform (MTP) test-case metadata surfaced to Stryker’s reporting pipeline (file path, line, and a better fully-qualified name), and adjusts TestRunResult to correctly retain test descriptions when a run represents “all tests”. It also expands repository Copilot guidance.
Changes:
- Treat
executedTests.IsEveryTestas “include all discovered descriptions” when constructingTestRunResult.TestDescriptions. - Extend MTP
TestNode/MtpTestCaseto carry location metadata intoITestCasefields used for reporting. - Add unit tests validating MTP location deserialization and
MtpTestCasefield population; update.github/copilot-instructions.mdcontent.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Stryker.TestRunner/Results/TestRunResult.cs | Avoids filtering out all test descriptions when ExecutedTests represents “every test”. |
| src/Stryker.TestRunner.MicrosoftTestPlatform/Models/TestNode.cs | Adds optional JSON-mapped location fields needed for reporting. |
| src/Stryker.TestRunner.MicrosoftTestPlatform/Models/MtpTestCase.cs | Maps MTP node location/type/method into ITestCase properties for downstream consumers. |
| src/Stryker.TestRunner.MicrosoftTestPlatform.UnitTest/MtpTestCaseTests.cs | Adds coverage for location deserialization and MtpTestCase population behavior. |
| .github/copilot-instructions.md | Expands repo overview and updates local testing guidance/examples. |
| TestDescriptions = executedTests.IsEveryTest | ||
| ? vsTestDescriptions.ToList() | ||
| : vsTestDescriptions.Where(p => executedTests.GetIdentifiers().Contains(p.Id)).ToList(); |
| public MtpTestCase(TestNode testNode) | ||
| { | ||
| _testNode = testNode; | ||
| CodeFilePath = testNode.LocationFile ?? string.Empty; |
|
|
||
| To test Stryker.NET on a project in a terminal, you can build Stryker.NET and then run the resulting `stryker.dll` on the target project. Run `dotnet <path-to-stryker.dll>` in the root of the project you want to test (adjust path as needed based on your build configuration). | ||
|
|
||
| For example in the `/integrationtest/TargetProjects/NetCore/TargetProject` directory, you can run `dotnet ../../src/Stryker.CLI/bin/Debug/net8.0/stryker.dll` to test Stryker.NET on the target projects. |



related to #3094
Also improve copilot-instructions