Skip to content

Support artifacts output mode for MTP test results - #55609

Merged
Evangelink merged 4 commits into
mainfrom
dev/amauryleve/support-artifacts-test-results
Aug 7, 2026
Merged

Support artifacts output mode for MTP test results#55609
Evangelink merged 4 commits into
mainfrom
dev/amauryleve/support-artifacts-test-results

Conversation

@Evangelink

@Evangelink Evangelink commented Aug 5, 2026

Copy link
Copy Markdown
Member

Summary

  • read UseArtifactsOutput, ArtifactsPath, ArtifactsProjectName, and ArtifactsPivots from evaluated MTP test projects
  • default test artifacts to <ArtifactsPath>/test/<project>/<pivot> when artifacts output is enabled
  • preserve explicit --results-directory and --results-directory-layout choices
  • place post-processed reports in the shared artifacts test directory

The test category is a sibling of bin, obj, package, and publish; it can contain reports, coverage, diagnostics, and other generated test artifacts without implying every file is a test result.

Fixes #54612

Validation

  • full build.cmd
  • 52 focused dotnet.Tests covering artifacts defaults, explicit layout precedence, collisions, and artifact post-processing

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 5, 2026 16:08
@Evangelink
Evangelink requested a review from a team as a code owner August 5, 2026 16:08
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates dotnet test’s Microsoft Testing Platform (MTP) integration to recognize MSBuild’s artifacts output mode and default test results into the artifacts layout when enabled, while preserving explicitly specified --results-directory / --results-directory-layout behavior. It also ensures artifact post-processing outputs land in the shared artifacts results directory.

Changes:

  • Plumb UseArtifactsOutput, ArtifactsPath, ArtifactsProjectName, and ArtifactsPivots from evaluated test projects into the MTP TestModule model.
  • Update results-directory resolution to default to <ArtifactsPath>/test-results/<project>/<pivot> when artifacts output is enabled (unless the user explicitly overrides results directory/layout).
  • Adjust artifact post-processing output directory selection and expand test coverage for artifacts output defaults and precedence rules.
Show a summary per file
File Description
test/dotnet.Tests/CommandTests/Test/TestResultsDirectoryResolverTests.cs Adds unit tests covering artifacts output defaults and explicit layout precedence.
test/dotnet.Tests/CommandTests/Test/TestCommandParserTests.cs Extends parser tests to validate the new ResultsDirectoryLayoutSpecified signal.
test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTests.cs Adds an integration test verifying artifacts output places reports under artifacts/test-results and avoids TestResults.
test/dotnet.Tests/CommandTests/Test/ArtifactPostProcessingManagerTests.cs Adds coverage for artifact-mode output directory selection; refactors job construction for module injection.
src/Cli/dotnet/Commands/Test/MTP/TestResultsDirectoryResolver.cs Implements artifacts-aware default root/layout behavior and introduces ResultsDirectoryLayoutSpecified-gated defaults.
src/Cli/dotnet/Commands/Test/MTP/SolutionAndProjectUtility.cs Reads artifacts-related MSBuild properties and stores them into TestModule.
src/Cli/dotnet/Commands/Test/MTP/Options.cs Adds ResultsDirectoryLayoutSpecified to PathOptions.
src/Cli/dotnet/Commands/Test/MTP/MSBuildUtility.cs Sets ResultsDirectoryLayoutSpecified based on whether --results-directory-layout was explicitly provided.
src/Cli/dotnet/Commands/Test/MTP/Models.cs Extends TestModule to carry artifacts output metadata.
src/Cli/dotnet/Commands/Test/MTP/ArtifactPostProcessingManager.cs Prefers the artifacts results directory as the merge output location when artifacts output is enabled.
src/Cli/dotnet/Commands/Test/CliConstants.cs Adds MSBuild property name constants for artifacts output mode integration.

Copilot's findings

Suppressed comments (1)

src/Cli/dotnet/Commands/Test/MTP/TestResultsDirectoryResolver.cs:236

  • This comment claims the pivot deliberately excludes configuration, but when artifacts output defaults are used the pivot comes from $(ArtifactsPivots), whose default value includes configuration (for example: debug_net8.0). This mismatch makes the behavior harder to reason about and can confuse future changes.
    /// The pivot folder distinguishing runs of the same project across target frameworks and
    /// runtimes. Multiple elements are joined by an underscore, following the artifacts layout.
    /// The configuration is deliberately not part of the pivot: a single test run targets one
    /// configuration, so it would only ever add a constant level to every path.
    /// </summary>
  • Files reviewed: 11/11 changed files
  • Comments generated: 1

Comment thread src/Cli/dotnet/Commands/Test/MTP/TestResultsDirectoryResolver.cs
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 006e6be5-b01a-46e4-ab59-ea54c91a2864
@Evangelink
Evangelink enabled auto-merge August 6, 2026 07:59
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 006e6be5-b01a-46e4-ab59-ea54c91a2864
@Evangelink

Copy link
Copy Markdown
Member Author

@baronfel FYI

@Evangelink
Evangelink merged commit 3e28731 into main Aug 7, 2026
21 checks passed
@Evangelink
Evangelink deleted the dev/amauryleve/support-artifacts-test-results branch August 7, 2026 12:58
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.

dotnet-test mtp should support MSBuild's artifacts output mode

3 participants