Uh oh!
There was an error while loading. Please reload this page.
Dogfood --report-junit and OpenTelemetry processing in CI - #8965
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the existing CI dogfooding pattern for MTP extensions by enabling JUnit XML reporting (--report-junit) and exercising the OpenTelemetry result handling pipeline during the repo’s own unit test runs.
Changes:
- Updated multiple test-host
Program.csentrypoints to registerAddJUnitReportProvider()and to wireAddOpenTelemetryProvider(...AddTestingPlatformInstrumentation...). - Updated
test/Directory.Build.targetsto addProjectReferences forMicrosoft.Testing.Extensions.JUnitReportandMicrosoft.Testing.Extensions.OpenTelemetry, and to inject--report-junit/--report-junit-filenameintoTestingPlatformCommandLineArguments. - Updated Azure Pipelines scripts to pass
--report-junit --report-junit-filename "{asm}_{tfm}.xml"when runningdotnet test --test-modules(which bypasses MSBuild evaluation).
Show a summary per file
| File | Description |
|---|---|
| test/UnitTests/TestFramework.UnitTests/Program.cs | Registers JUnit report + OpenTelemetry instrumentation in this unit test host. |
| test/UnitTests/MSTestAdapter.UnitTests/Program.cs | Registers JUnit report + OpenTelemetry instrumentation in this unit test host. |
| test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/Program.cs | Registers JUnit report + OpenTelemetry instrumentation in this unit test host. |
| test/UnitTests/MSTest.SourceGeneration.UnitTests/Program.cs | Registers JUnit report + OpenTelemetry instrumentation in this unit test host. |
| test/UnitTests/MSTest.SelfRealExamples.UnitTests/Program.cs | Registers JUnit report + OpenTelemetry instrumentation in this unit test host. |
| test/UnitTests/MSTest.Analyzers.UnitTests/Program.cs | Registers JUnit report + OpenTelemetry instrumentation in this unit test host. |
| test/UnitTests/Microsoft.Testing.Platform.UnitTests/Program.cs | Registers JUnit report + OpenTelemetry instrumentation in this unit test host. |
| test/UnitTests/Microsoft.Testing.Platform.MSBuild.UnitTests/Program.cs | Registers JUnit report + OpenTelemetry instrumentation in this unit test host. |
| test/UnitTests/Microsoft.Testing.Extensions.VSTestBridge.UnitTests/Program.cs | Registers JUnit report and conditionally wires OpenTelemetry when not NATIVE_AOT. |
| test/UnitTests/Microsoft.Testing.Extensions.UnitTests/Program.cs | Registers JUnit report + OpenTelemetry instrumentation in this unit test host. |
| test/Directory.Build.targets | Adds extension ProjectReferences and injects JUnit CLI options into MTP runs. |
| eng/pipelines/steps/test-non-windows.yml | Adds JUnit CLI options to the Release --test-modules path. |
| azure-pipelines.yml | Adds JUnit CLI options to the Release --test-modules path on Windows. |
| .github/workflows/shared/grade-tests-shared.md | Documentation update: switch guidance example table to raw HTML for fixed column widths. |
Copilot's findings
- Files reviewed: 14/14 changed files
- Comments generated: 1
Uh oh!
There was an error while loading. Please reload this page.
Follow up to the AzDO/TRX dogfooding pattern: now also exercise the newest report extension (JUnitReport, microsoft#8850) and the OpenTelemetry processing pipeline end-to-end as part of our own CI test runs. JUnit: - test/Directory.Build.targets adds Microsoft.Testing.Extensions.JUnitReport as a ProjectReference for every test project that opts into MTP and wires --report-junit / --report-junit-filename into the MSBuild path. - azure-pipelines.yml and eng/pipelines/steps/test-non-windows.yml also pass --report-junit --report-junit-filename "{asm}_{tfm}.xml" on the Release dotnet test --test-modules path (which bypasses MSBuild evaluation). - Each test project's Program.cs explicitly calls AddJUnitReportProvider() (TestingPlatformBuilderHook auto-registration only fires for NuGet consumers, not source ProjectReferences). OpenTelemetry: - test/Directory.Build.targets adds Microsoft.Testing.Extensions.OpenTelemetry as a ProjectReference. - Each test project's Program.cs registers AddOpenTelemetryProvider with AddTestingPlatformInstrumentation on both the tracer and meter builders. No exporter is wired: the SDK still creates real Activities and Counters because the sources/meters now have listeners, so data flows through the full OpenTelemetryResultHandler pipeline and is dropped at the export stage. Sufficient to exercise the handler in CI without polluting logs. - VSTestBridge.UnitTests gates OTel registration on !NATIVE_AOT to match its existing AOT-aware Program.cs pattern (the OTel SDK uses reflection). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… programs Copilot reviewer caught (and Linux/Windows Debug CI confirmed): the 5 integration/acceptance test projects under test/IntegrationTests/ also opt into the Microsoft.Testing.Platform via EnableMSTestRunner / UseInternalTestFramework, so they pick up the --report-junit / --report-junit-filename arguments injected from test/Directory.Build.targets, but they never registered the JUnitReport extension in their explicit Program.cs files. The Debug runs failed at startup with `Unknown option 'report-junit'`. Add AddJUnitReportProvider() alongside the existing AddTrxReportProvider() call and an AddOpenTelemetryProvider(...) block (mirroring the 10 unit-test Program.cs files) to: - PlatformServices.Desktop.IntegrationTests - MSTest.Acceptance.IntegrationTests - Microsoft.Testing.Platform.Acceptance.IntegrationTests - MSTest.IntegrationTests - MSTest.VstestConsoleWrapper.IntegrationTests Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
889d67a to
d6edbcaCompareAmaury Levé (Evangelink)
commented
Jun 9, 2026
Rebased onto latest For the Windows Release failure, two things were going on in the previous run:
Re-running CI on the rebased commit will follow up if either reproduces. |
662eede
into
microsoft:mainUh oh!
There was an error while loading. Please reload this page.
Follow up to the AzDO/TRX dogfooding pattern (#0028908d): now also exercise the newest report extension (JUnitReport, #8850) and the OpenTelemetry processing pipeline end-to-end as part of our own CI test runs.
JUnit Report (
--report-junit)test/Directory.Build.targetsaddsMicrosoft.Testing.Extensions.JUnitReportas aProjectReferencefor every test project that opts into MTP and wires--report-junit/--report-junit-filenameinto the MSBuild path.azure-pipelines.ymlandeng/pipelines/steps/test-non-windows.ymlalso pass--report-junit --report-junit-filename "{asm}_{tfm}.xml"on the Releasedotnet test --test-modulespath (which bypasses MSBuild evaluation).Program.csexplicitly callsAddJUnitReportProvider().TestingPlatformBuilderHookauto-registration only fires for NuGet consumers, not sourceProjectReferenceconsumers.OpenTelemetry processing
test/Directory.Build.targetsaddsMicrosoft.Testing.Extensions.OpenTelemetryas aProjectReference.Program.csregistersAddOpenTelemetryProviderwithAddTestingPlatformInstrumentationon both the tracer and meter builders.Activity/Counterinstances because the sources/meters now have listeners, so data flows through the fullOpenTelemetryResultHandlerpipeline and is then dropped at the export stage. That's sufficient to exercise the handler (which has been actively optimised recently, e.g. [efficiency-improver] perf: single-pass PropertyBag walk in OpenTelemetryResultHandler.HandleTestResult #8938) without polluting CI logs. We can wire an actual exporter later if we want to publish the data anywhere.VSTestBridge.UnitTestsgates OTel registration on!NATIVE_AOTto match the existing AOT-awareProgram.cspattern there (the OTel SDK uses reflection).Verification
Microsoft.Testing.Extensions.UnitTestsend-to-end with both extensions registered: 431 tests pass and a ~230 KB JUnit XML report is emitted (<testsuites name="Microsoft.Testing.Extensions.UnitTests" tests="431" failures="0" ...>).