Skip to content

Fix TRX result attachment layout to include per-test relative results directory#8188

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-incorrect-result-file-paths
Draft

Fix TRX result attachment layout to include per-test relative results directory#8188
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-incorrect-result-file-paths

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 13, 2026

Bug Fix

What was the bug?

With --report-trx --results-directory TestResults, per-test artifacts were copied to .../In/<machine>/... while TRX consumers resolved attachments via .../In/<relativeResultsDirectory>/<machine>/.... This mismatch caused attachment open failures locally and dropped attachments in Azure DevOps publishing.

How did you fix it?

  • Align per-test artifact copy path with TRX resolution semantics
    • Updated TrxReportEngine to route per-test artifact copies under:
      • <resultsDirectory>/<runDeploymentRoot>/In/<executionId>/<machineName>/...
    • executionId is already emitted as relativeResultsDirectory, so physical layout now matches downstream lookup behavior.
  • Keep existing href behavior unchanged
    • ResultFile path remains machine-relative (<machineName>/<fileName>), preserving current TRX payload shape.
  • Add focused regression coverage
    • Extended the existing TRX unit test to assert copy destination includes the relativeResultsDirectory segment.
string directoryName = relativeResultsDirectory is null
    ? Path.Combine(_configuration.GetTestResultDirectory(), runDeploymentRoot, "In", _environment.MachineName)
    : Path.Combine(_configuration.GetTestResultDirectory(), runDeploymentRoot, "In", relativeResultsDirectory, _environment.MachineName);

// per-test artifacts now pass executionId as relativeResultsDirectory
string href = CopyArtifactIntoTrxDirectoryAndReturnHrefValue(testFileArtifact.FileInfo, runDeploymentRoot, executionId);

Testing

Added/updated unit coverage in TrxTests to verify that per-test artifact copy paths include:
.../In/<relativeResultsDirectory>/MachineName/fileName.

Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot May 13, 2026 16:37
Copilot AI changed the title [WIP] Fix incorrect paths to result files after merge Fix TRX result attachment layout to include per-test relative results directory May 13, 2026
Copilot AI requested a review from Evangelink May 13, 2026 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants