You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add direct unit test coverage for two zero-coverage helper types in Microsoft.Testing.Extensions.OpenTelemetry that had never been exercised in isolation:
ActivityWrapper (adapts System.Diagnostics.Activity onto IPlatformActivity) — only covered indirectly through OpenTelemetryPlatformServiceTests, which never drives the non-W3C id-format fallback, IsRecording, the fluent SetTag return value, RecordException's additional-tags merge, or the non-ambient Dispose() path that restores Activity.Current.
OpenTelemetryEnvironmentVariables.IsNullOrWhiteSpace — a hand-rolled character scan (used in place of the banned string.IsNullOrWhiteSpace) that gates every environment-variable read across the extension, but had no direct test.
Approach
ActivityWrapperTests.cs: constructs plain Activity instances directly (no listener needed) and asserts against ActivityWrapper's public surface — Hierarchical vs. W3C id-format branch for TraceId/SpanId, IsRecording reflecting Activity.IsAllDataRequested, SetTag mutating the underlying activity and returning this, RecordException merging caller-supplied tags alongside the conventional exception tags, and the non-ambient Dispose() restoring Activity.Current.
OpenTelemetryEnvironmentVariablesTests.cs: table-driven (DataRow) tests for null, empty, whitespace-only, and non-whitespace inputs, plus a mixed "leading whitespace then content" case.
Both files follow the existing direct-unit-test conventions already used in this project (e.g. MeasurementWrapperTests.cs, TestingPlatformResourceDetectorTests.cs) — no new test infrastructure needed.
Coverage impact
Suite
Before
After
Microsoft.Testing.Extensions.UnitTests (net8.0)
1879 total, 0 failed, 37 skipped
1892 total, 0 failed, 37 skipped
Trade-offs
Small, focused, low-maintenance additions — no new abstractions or test infrastructure, and both new files sit alongside their existing sibling test files for the same extension area.
🤖 Automated content by GitHub Copilot. Generated by the Test Improver workflow. · copilot · auto · 215.3 AIC · ⌖ 19.4 AIC · ⊞ 16.8K · [◷]( · ◷) 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
Goal
Add direct unit test coverage for two zero-coverage helper types in
Microsoft.Testing.Extensions.OpenTelemetrythat had never been exercised in isolation:ActivityWrapper(adaptsSystem.Diagnostics.ActivityontoIPlatformActivity) — only covered indirectly throughOpenTelemetryPlatformServiceTests, which never drives the non-W3C id-format fallback,IsRecording, the fluentSetTagreturn value,RecordException's additional-tags merge, or the non-ambientDispose()path that restoresActivity.Current.OpenTelemetryEnvironmentVariables.IsNullOrWhiteSpace— a hand-rolled character scan (used in place of the bannedstring.IsNullOrWhiteSpace) that gates every environment-variable read across the extension, but had no direct test.Approach
ActivityWrapperTests.cs: constructs plainActivityinstances directly (no listener needed) and asserts againstActivityWrapper's public surface — Hierarchical vs. W3C id-format branch forTraceId/SpanId,IsRecordingreflectingActivity.IsAllDataRequested,SetTagmutating the underlying activity and returningthis,RecordExceptionmerging caller-supplied tags alongside the conventional exception tags, and the non-ambientDispose()restoringActivity.Current.OpenTelemetryEnvironmentVariablesTests.cs: table-driven (DataRow) tests for null, empty, whitespace-only, and non-whitespace inputs, plus a mixed "leading whitespace then content" case.Both files follow the existing direct-unit-test conventions already used in this project (e.g.
MeasurementWrapperTests.cs,TestingPlatformResourceDetectorTests.cs) — no new test infrastructure needed.Coverage impact
Microsoft.Testing.Extensions.UnitTests(net8.0)Trade-offs
Small, focused, low-maintenance additions — no new abstractions or test infrastructure, and both new files sit alongside their existing sibling test files for the same extension area.
Reproducibility
Test Status
Build succeeded (0 warnings/errors). Full
Microsoft.Testing.Extensions.UnitTestsnet8.0 suite: 1892 total, 0 failed, 37 skipped (no regressions).dotnet format whitespace TestFx.slnx --verify-no-changes --include <new files>clean.Note
This was originally intended as a pull request, but the git push operation failed.
Original error: The process '/usr/bin/git' failed with exit code 128
Workflow Run: View run details and download bundle artifact
The bundle file is available in the
agentartifact in the workflow run linked above.Create the pull request manually
Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
southcentralus0.in.applicationinsights.azure.comTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.
Add this agentic workflow to your repo
To install this agentic workflow, run