Skip to content

chore: Add test information to mtp result for reporting#3541

Open
richardwerkman wants to merge 3 commits intomasterfrom
feature/test-reporting-mtp
Open

chore: Add test information to mtp result for reporting#3541
richardwerkman wants to merge 3 commits intomasterfrom
feature/test-reporting-mtp

Conversation

@richardwerkman
Copy link
Copy Markdown
Member

related to #3094

Also improve copilot-instructions

Copilot AI review requested due to automatic review settings April 10, 2026 12:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 TestNode model to deserialize location metadata (file/line/type/method) from MTP JSON payloads.
  • Populate MtpTestCase with CodeFilePath, LineNumber, and a derived FullyQualifiedName.
  • Add unit tests covering location deserialization and MtpTestCase mapping; update .github/copilot-instructions.md content/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).

Comment on lines 12 to +15
_testNode = testNode;
CodeFilePath = testNode.LocationFile ?? string.Empty;
LineNumber = testNode.LocationLineStart ?? 0;
FullyQualifiedName = BuildFullyQualifiedName(testNode);
Comment on lines +13 to +14
CodeFilePath = testNode.LocationFile ?? string.Empty;
LineNumber = testNode.LocationLineStart ?? 0;
Comment on lines +48 to +53
public void MtpTestCase_WithoutLocationType_FallsBackToUid()
{
var testNode = new TestNode("uid-1", "TestMethod1", "action", "discovered",
LocationFile: "/path/to/TestFile.cs",
LocationLineStart: 10);

Comment on lines +85 to 86
## 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`.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should work with the Stryker on Stryker script

Copilot AI review requested due to automatic review settings April 10, 2026 15:12
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.IsEveryTest as “include all discovered descriptions” when constructing TestRunResult.TestDescriptions.
  • Extend MTP TestNode/MtpTestCase to carry location metadata into ITestCase fields used for reporting.
  • Add unit tests validating MTP location deserialization and MtpTestCase field population; update .github/copilot-instructions.md content.

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.

Comment on lines +31 to +33
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants