Skip to content

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

Open
richardwerkman wants to merge 7 commits into
masterfrom
feature/test-reporting-mtp
Open

feat: Add test information to mtp result for reporting#3541
richardwerkman wants to merge 7 commits into
masterfrom
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 thread .github/copilot-instructions.md
Comment thread .github/copilot-instructions.md Outdated

### 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();
Comment thread src/Stryker.TestRunner.MicrosoftTestPlatform/Models/MtpTestCase.cs
Comment thread .github/copilot-instructions.md Outdated

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.
Co-authored-by: Copilot <copilot@github.com>
@richardwerkman richardwerkman changed the title chore: Add test information to mtp result for reporting feat: Add test information to mtp result for reporting Apr 24, 2026
Co-authored-by: Copilot <copilot@github.com>
Copilot AI review requested due to automatic review settings April 24, 2026 16:07
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) support by enriching test case data (file path, line, fully qualified name) so Stryker can include test information in reports, and updates validations accordingly. It also includes a release-script enhancement and expanded Copilot instructions.

Changes:

  • Populate MTP test case location/type metadata and add unit tests to verify JSON deserialization + mapping behavior.
  • Fix/optimize TestRunResult test-description selection to correctly include all tests when the runner reports “every test executed”.
  • Update integration validations to assert test counts for MTP target projects.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/Stryker.TestRunner/Results/TestRunResult.cs Uses IsEveryTest to include all descriptions; avoids repeated identifier lookups.
src/Stryker.TestRunner.MicrosoftTestPlatform/Models/TestNode.cs Adds optional location metadata fields for MTP JSON payloads.
src/Stryker.TestRunner.MicrosoftTestPlatform/Models/MtpTestCase.cs Maps MTP node location/type to ITestCase properties used for reporting.
src/Stryker.TestRunner.MicrosoftTestPlatform.UnitTest/MtpTestCaseTests.cs Adds unit tests covering mapping + JSON deserialization of new fields.
prepare-release.js Adds conventional-commit-based version suggestion and release note/tag creation changes.
integrationtest/Validation/ValidationProject/ValidateStrykerResults.cs Asserts non-zero test totals for MTP-based runs.
.github/copilot-instructions.md Expands repository overview and local testing guidance.

Comment on lines +31 to +34
var executedTestsSet = executedTests.GetIdentifiers().ToHashSet();
TestDescriptions = executedTests.IsEveryTest
? vsTestDescriptions.ToList()
: vsTestDescriptions.Where(p => executedTestsSet.Contains(p.Id)).ToList();

For example in the `/integrationtest/TargetProjects/NetCore/TargetProject` directory, you can run `dotnet ../../../../src/Stryker.CLI/Stryker.CLI/bin/Debug/net8.0/Stryker.CLI.dll` to run the locally built Stryker.NET on the target projects.

Keep in mind the different runmodes of Stryker.NET:
Comment thread .github/copilot-instructions.md Outdated
Comment thread prepare-release.js
Comment thread prepare-release.js
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 8, 2026 07:35
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

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Comment thread prepare-release.js
Comment on lines +2 to +6
const { promisify } = require('util');
const readline = require('readline');
const fs = require('fs');
const semver = require('semver');
const conventionalRecommendedBump = require('conventional-recommended-bump');
Comment thread prepare-release.js
Comment on lines +76 to +83
const changelogPath = './CHANGELOG.md';
const changelog = fs.readFileSync(changelogPath, { encoding: 'UTF-8' });
const marker = '<!-- changelog -->';
if (!changelog.includes(marker)) {
throw new Error(`${changelogPath} is missing the '${marker}' insertion marker`);
}
});
fs.writeFileSync(changelogPath, changelog.replace(marker, `${marker}\n\n${releaseNotes}`), { encoding: 'UTF-8' });
}
Comment on lines +5 to +9
namespace Stryker.TestRunner.MicrosoftTestPlatform.UnitTest;

[TestClass]
public class MtpTestCaseTests
{
Comment on lines +31 to +34
var executedTestsSet = executedTests.GetIdentifiers().ToHashSet();
TestDescriptions = executedTests.IsEveryTest
? vsTestDescriptions.ToList()
: vsTestDescriptions.Where(p => executedTestsSet.Contains(p.Id)).ToList();
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