Skip to content

[test-improver] Add unit tests for ArtifactPostProcessingHelper.OrderInputs #10746

Closed

Description

@github-actions

Caution

agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.

Details

Potential security threats were detected in the agent output.

Review the workflow run logs for details.

Goal and rationale

ArtifactPostProcessingHelper.OrderInputs implements the deterministic multi-key sort used by every artifact post-processor (Trx, JUnit, Ctrf, Html) to order input artifacts before merging. It had zero direct unit test coverage despite being shared, non-trivial logic (5 sort keys, a module-metadata toggle, and full-path normalization).

Approach

ArtifactPostProcessingHelper is internal static and linked into multiple report-engine assemblies, so it cannot be referenced directly from the test project (would cause an ambiguous-type error). Following the existing pattern used for IsReparsePoint in the same test file, OrderInputs is resolved via reflection against the TrxReport assembly and invoked through a small helper.

Added 3 tests to ArtifactPostProcessingHelperTests.cs:

  • OrderInputs_WithoutModuleMetadata_OrdersByPathThenExecutionId - verifies the path + executionId sort when includeModuleMetadata: false.
  • OrderInputs_WithModuleMetadata_OrdersByPathThenModuleThenFrameworkThenArchitectureThenExecutionId - verifies the full 5-key sort (path, module, framework, architecture, executionId) when includeModuleMetadata: true.
  • OrderInputs_ComparesPathsByFullPath_NotByRawInputString - verifies relative and absolute paths pointing to the same location resolve via Path.GetFullPath before comparison, rather than being compared as raw strings.

Coverage impact

Before After
ArtifactPostProcessingHelperTests tests 4 7
OrderInputs direct coverage none 3 tests

Trade-offs

Minimal added maintenance burden - tests reuse the existing reflection-based invocation pattern already established for IsReparsePoint, so no new test infrastructure was introduced.

Reproducibility

dotnet run --project test/UnitTests/Microsoft.Testing.Extensions.UnitTests -f net9.0 --no-build -c Debug -- --filter "FullyQualifiedName~ArtifactPostProcessingHelperTests"

Test Status

  • Build: succeeded (0 warnings, 0 errors)
  • Targeted tests: 7/7 passed
  • Full Microsoft.Testing.Extensions.UnitTests suite: 1184 passed, 0 failed, 34 skipped (no regressions)
  • dotnet format whitespace --verify-no-changes: clean

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • southcentralus0.in.applicationinsights.azure.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "southcentralus0.in.applicationinsights.azure.com"

See Network Configuration for more information.

🤖 Automated content by GitHub Copilot. Generated by the Test Improver workflow. · auto · 182.4 AIC · ⌖ 3.39 AIC · ⊞ 19.4K · [◷]( · ◷)
Comment /test-assist to run again

Add this agentic workflow to your repo

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/test-improver.md@main

Note

This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch test-assist/artifact-post-processing-helper-orderinputs-b77666abf1db50af.

Click here to create the pull request

To fix the permissions issue, go to Settings → Actions → General and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ

Show patch preview (125 of 125 lines)
From dd98d5aaecb7e7a9ef737e7f6b405347ea14d7e0 Mon Sep 17 00:00:00 2001
X-GH-AW-Base-Commit: 86e88e328d31a675d1caf0ac0d97c451eab1650e
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Tue, 25 Aug 2026 23:12:11 +0000
Subject: [PATCH] Add unit tests for ArtifactPostProcessingHelper.OrderInputs

Cover the multi-key deterministic sort (path, module, framework,
architecture, execution id) used by Trx/JUnit/Ctrf/Html artifact
post-processors, including the includeModuleMetadata=false path and
relative-vs-absolute path resolution.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 .../ArtifactPostProcessingHelperTests.cs      | 70 ++++++++++++++++++-
 1 file changed, 68 insertions(+), 2 deletions(-)

diff --git a/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/ArtifactPostProcessingHelperTests.cs b/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/ArtifactPostProcessingHelperTests.cs
index 4d57660..53411e2 100644
--- a/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/ArtifactPostProcessingHelperTests.cs
+++ b/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/ArtifactPostProcessingHelperTests.cs
@@ -8,20 +8,31 @@
 #endif
 
 using Microsoft.Testing.Extensions.TrxReport.Abstractions;
+using Microsoft.Testing.Platform.Extensions.ArtifactPostProcessing;
 
 namespace Microsoft.Testing.Extensions.UnitTests;
 
+#pragma warning disable TPEXP // Artifact post-processing is experimental.
+
 [TestClass]
 public sealed class ArtifactPostProcessingHelperTests
 {
     // ArtifactPostProcessingHelper is linked into each report-engine assembly, so resolve the
     // TrxReport copy through reflection to avoid an ambiguous type reference.
+    private static readonly Type ArtifactPostProcessingHelperType =
+        typeof(TrxReportEngine).Assembly.GetType("Microsoft.Testing.Extensions.ArtifactPostProcessingHelper")
+            ?? throw new InvalidOperationException("Could not find type ArtifactPostProcessingHelper in 
... (truncated)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions