Skip to content

Commit 32077b2

Browse files
EvangelinkCopilot
andauthored
Improve readability of Azure DevOps skip-reason summaries (#12236)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent ce25165 commit 32077b2

4 files changed

Lines changed: 155 additions & 48 deletions

File tree

‎src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/AzureDevOpsSummaryReporter.Markdown.Skips.cs‎

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,35 @@ .. modules
3434
];
3535

3636
builder.Append(new string('#', headingLevel)).Append(" Skipped tests by reason\n\n");
37-
builder.Append("| Skipped | Reason | Platform | Test module |\n");
38-
builder.Append("| ---: | --- | --- | --- |\n");
39-
foreach ((CiRunSummaryModule module, CiRunSummarySkipReason reason) in reasons)
37+
bool hasSharedContext = modules.Count == 1;
38+
if (hasSharedContext)
4039
{
41-
builder.Append("| ").Append(reason.Count.ToString(CultureInfo.InvariantCulture))
42-
.Append(" | ").Append(EscapeCell(reason.Reason))
43-
.Append(" | ").Append(EscapeCell(module.OperatingSystem ?? "Unavailable"))
44-
.Append(" | ");
40+
CiRunSummaryModule module = modules[0];
41+
builder.Append("**Test module:** ");
4542
AppendModuleIdentity(builder, modules, module);
46-
builder.Append(" |\n");
43+
builder.Append(" \u00b7 **Platform:** ").Append(EscapeCell(module.OperatingSystem ?? "Unavailable"))
44+
.Append("\n\n");
45+
}
46+
47+
foreach ((CiRunSummaryModule module, CiRunSummarySkipReason reason) in reasons)
48+
{
49+
builder.Append("- **").Append(reason.Count.ToString(CultureInfo.InvariantCulture))
50+
.Append(" skipped** \u2014 ").Append(EscapeCell(reason.Reason));
51+
if (!hasSharedContext)
52+
{
53+
builder.Append("\n\n **Test module:** ");
54+
AppendModuleIdentity(builder, modules, module);
55+
builder.Append(" \u00b7 **Platform:** ").Append(EscapeCell(module.OperatingSystem ?? "Unavailable"));
56+
}
57+
58+
builder.Append(hasSharedContext ? "\n" : "\n\n");
59+
}
60+
61+
if (hasSharedContext)
62+
{
63+
builder.Append('\n');
4764
}
4865

49-
builder.Append('\n');
5066
long omittedTests = skippedTests - reasons.Sum(static item => item.Reason.Count);
5167
if (omittedTests > 0)
5268
{

‎src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/PACKAGE.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ When the SDK supplies an authoritative final invocation exit, the aggregate show
2929

3030
Skipped tests are grouped by their reported reason and execution platform, with module/target-framework context and at most ten groups shown. Issue references in reasons are retained; skipped test names are not dumped into the summary. Omitted groups are accounted for by a skipped-test count. Older summary fragments remain supported and label unavailable outcomes, skip reasons, and platform metadata explicitly.
3131

32+
Skip-reason groups use compact list entries so long explanations can wrap without competing with metadata columns. A single-module summary shows the shared module and platform once; multi-module summaries keep that context with each reason.
33+
3234
## Usage
3335

3436
Enable Azure DevOps reporting with the `--report-azdo` command line option.

‎test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/AzureDevOpsSummaryAcceptanceTests.cs‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,17 @@ private static void AssertStandaloneSummary(string markdown)
112112
$"""
113113
## ❌ AzureDevOpsSummaryBehavior (net10.0)
114114
115-
**4 tests** · ✅ **1 passed** · ❌ **1 failed** · ⏭ **2 skipped** · ⏱ Test time: **17.50s** · exit code **2** (AtLeastOneTestFailed — At least one test failed.)
115+
**6 tests** · ✅ **1 passed** · ❌ **1 failed** · ⏭ **4 skipped** · ⏱ Test time: **17.50s** · exit code **2** (AtLeastOneTestFailed — At least one test failed.)
116116
117117
> Test time is the sum of reported test durations, not elapsed time; tests may run concurrently.
118118
119119
### Skipped tests by reason
120120
121-
| Skipped | Reason | Platform | Test module |
122-
| ---: | --- | --- | --- |
123-
| 2 | Known issue https://example.test/issues/42 | {operatingSystem} | AzureDevOpsSummaryBehavior (net10.0, {architecture}) |
121+
**Test module:** AzureDevOpsSummaryBehavior (net10.0, {architecture}) · **Platform:** {operatingSystem}
122+
123+
- **2 skipped** — Known issue https://example.test/issues/42
124+
- **1 skipped** — Awaiting &lt;package&gt; &amp; &quot;native&quot; support \| see https://example.test/issues/314
125+
- **1 skipped** — Packaged Windows apps are a Windows-only scenario; the launcher is intentionally disabled on other platforms so that unsupported activation is not attempted.
124126
125127
### Top failing classes
126128
@@ -202,6 +204,12 @@ await PublishAsync(context, "PrivateSkippedName1",
202204
new SkippedTestNodeStateProperty(" Known issue\nhttps://example.test/issues/42 "), TimeSpan.Zero);
203205
await PublishAsync(context, "PrivateSkippedName2",
204206
new SkippedTestNodeStateProperty("Known issue https://example.test/issues/42"), TimeSpan.Zero);
207+
await PublishAsync(context, "PrivateSkippedName3",
208+
new SkippedTestNodeStateProperty("Awaiting <package> & \"native\" support | see https://example.test/issues/314"),
209+
TimeSpan.Zero);
210+
await PublishAsync(context, "PrivateSkippedName4",
211+
new SkippedTestNodeStateProperty("Packaged Windows apps are a Windows-only scenario; the launcher is intentionally disabled on other platforms so that unsupported activation is not attempted."),
212+
TimeSpan.Zero);
205213
context.Complete();
206214
}
207215

‎test/UnitTests/Microsoft.Testing.Extensions.UnitTests/AzureDevOpsSummaryReporterTests.cs‎

Lines changed: 116 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ public void BuildMarkdown_RendersTotalsAndTopFailingAndSlowest()
9797
9898
### Skipped tests by reason
9999
100-
| Skipped | Reason | Platform | Test module |
101-
| ---: | --- | --- | --- |
102-
| 1 | Reason not provided | {GetOperatingSystem()} | MyAssembly (net8.0, unknown) |
100+
**Test module:** MyAssembly (net8.0, unknown) · **Platform:** {GetOperatingSystem()}
101+
102+
- **1 skipped** — Reason not provided
103103
104104
### Top failing classes
105105
@@ -1056,9 +1056,9 @@ public void BuildAggregateMarkdown_RendersOneGlobalTopTenWithOutcomesAndElapsedT
10561056
10571057
### Skipped tests by reason
10581058
1059-
| Skipped | Reason | Platform | Test module |
1060-
| ---: | --- | --- | --- |
1061-
| 1 | Tracked issue | Linux | Beta (net8.0, x64) |
1059+
- **1 skipped** — Tracked issue
1060+
1061+
**Test module:** Beta (net8.0, x64) · **Platform:** Linux
10621062
10631063
### Test modules
10641064
@@ -1248,9 +1248,9 @@ public void BuildMarkdown_RendersTimedSkippedOutcome()
12481248
12491249
### Skipped tests by reason
12501250
1251-
| Skipped | Reason | Platform | Test module |
1252-
| ---: | --- | --- | --- |
1253-
| 1 | Known issue | {GetOperatingSystem()} | Tests (net8.0, unknown) |
1251+
**Test module:** Tests (net8.0, unknown) · **Platform:** {GetOperatingSystem()}
1252+
1253+
- **1 skipped** — Known issue
12541254
12551255
> Duration history unavailable for the observed tests; current timings are not a historical baseline.
12561256
@@ -1298,10 +1298,55 @@ public void BuildAggregateMarkdown_SkipReasonsEscapeCellsAndPreserveLegacyMetada
12981298
"""
12991299
### Skipped tests by reason
13001300
1301-
| Skipped | Reason | Platform | Test module |
1302-
| ---: | --- | --- | --- |
1303-
| 3 | Skip reason unavailable (older fragment) | Unavailable | Legacy (net8.0, arm64) |
1304-
| 2 | https://example.test/issues/42 \| \`reason\` &lt;pending&gt;&amp;<br>next | Linux\|&lt;runner&gt; | A\|&lt;&amp;&gt; (net8.0, x64) |
1301+
- **3 skipped** — Skip reason unavailable (older fragment)
1302+
1303+
**Test module:** Legacy (net8.0, arm64) · **Platform:** Unavailable
1304+
1305+
- **2 skipped** — https://example.test/issues/42 \| \`reason\` &lt;pending&gt;&amp;<br>next
1306+
1307+
**Test module:** A\|&lt;&amp;&gt; (net8.0, x64) · **Platform:** Linux\|&lt;runner&gt;
1308+
1309+
1310+
""".Replace("\r\n", "\n"),
1311+
GetSection(markdown, "### Skipped tests by reason"));
1312+
}
1313+
1314+
[TestMethod]
1315+
public void BuildAggregateMarkdown_SingleModuleSkipReasonsShareContext()
1316+
{
1317+
var module = new CiRunSummaryModule
1318+
{
1319+
AssemblyName = "Microsoft.Testing.Extensions.UnitTests",
1320+
TargetFramework = "net10.0",
1321+
Architecture = "x64",
1322+
OperatingSystem = "Linux",
1323+
TotalTests = 3,
1324+
SkippedTests = 3,
1325+
SkipReasons =
1326+
[
1327+
new CiRunSummarySkipReason
1328+
{
1329+
Reason = "Packaged Windows apps are a Windows-only scenario; the launcher is intentionally disabled elsewhere.",
1330+
Count = 2,
1331+
},
1332+
new CiRunSummarySkipReason
1333+
{
1334+
Reason = "Awaiting <package> & \"native\" support | see https://example.test/issues/314",
1335+
Count = 1,
1336+
},
1337+
],
1338+
};
1339+
1340+
string markdown = AzureDevOpsSummaryReporter.BuildAggregateMarkdown(CreateObservedAggregate(module));
1341+
1342+
Assert.AreEqual(
1343+
"""
1344+
### Skipped tests by reason
1345+
1346+
**Test module:** Microsoft.Testing.Extensions.UnitTests (net10.0, x64) · **Platform:** Linux
1347+
1348+
- **2 skipped** — Packaged Windows apps are a Windows-only scenario; the launcher is intentionally disabled elsewhere.
1349+
- **1 skipped** — Awaiting &lt;package&gt; &amp; &quot;native&quot; support \| see https://example.test/issues/314
13051350
13061351
13071352
""".Replace("\r\n", "\n"),
@@ -1344,18 +1389,45 @@ public void BuildAggregateMarkdown_SkipReasonsCapsRowsAndAccountsForObservedOmis
13441389
"""
13451390
### Skipped tests by reason
13461391
1347-
| Skipped | Reason | Platform | Test module |
1348-
| ---: | --- | --- | --- |
1349-
| 3 | Primary | macOS | Beta (net9.0, arm64) |
1350-
| 2 | Reason0 | Windows | Alpha (net8.0, x64) |
1351-
| 2 | Reason1 | Windows | Alpha (net8.0, x64) |
1352-
| 2 | Reason2 | Windows | Alpha (net8.0, x64) |
1353-
| 2 | Reason3 | Windows | Alpha (net8.0, x64) |
1354-
| 2 | Reason4 | Windows | Alpha (net8.0, x64) |
1355-
| 2 | Reason5 | Windows | Alpha (net8.0, x64) |
1356-
| 2 | Reason6 | Windows | Alpha (net8.0, x64) |
1357-
| 2 | Reason7 | Windows | Alpha (net8.0, x64) |
1358-
| 2 | Reason8 | Windows | Alpha (net8.0, x64) |
1392+
- **3 skipped** — Primary
1393+
1394+
**Test module:** Beta (net9.0, arm64) · **Platform:** macOS
1395+
1396+
- **2 skipped** — Reason0
1397+
1398+
**Test module:** Alpha (net8.0, x64) · **Platform:** Windows
1399+
1400+
- **2 skipped** — Reason1
1401+
1402+
**Test module:** Alpha (net8.0, x64) · **Platform:** Windows
1403+
1404+
- **2 skipped** — Reason2
1405+
1406+
**Test module:** Alpha (net8.0, x64) · **Platform:** Windows
1407+
1408+
- **2 skipped** — Reason3
1409+
1410+
**Test module:** Alpha (net8.0, x64) · **Platform:** Windows
1411+
1412+
- **2 skipped** — Reason4
1413+
1414+
**Test module:** Alpha (net8.0, x64) · **Platform:** Windows
1415+
1416+
- **2 skipped** — Reason5
1417+
1418+
**Test module:** Alpha (net8.0, x64) · **Platform:** Windows
1419+
1420+
- **2 skipped** — Reason6
1421+
1422+
**Test module:** Alpha (net8.0, x64) · **Platform:** Windows
1423+
1424+
- **2 skipped** — Reason7
1425+
1426+
**Test module:** Alpha (net8.0, x64) · **Platform:** Windows
1427+
1428+
- **2 skipped** — Reason8
1429+
1430+
**Test module:** Alpha (net8.0, x64) · **Platform:** Windows
13591431
13601432
> 9 additional skipped tests are not shown.
13611433
@@ -1388,12 +1460,21 @@ public void BuildAggregateMarkdown_SkipReasonTiesUseModuleFrameworkAndAttemptIde
13881460
"""
13891461
### Skipped tests by reason
13901462
1391-
| Skipped | Reason | Platform | Test module |
1392-
| ---: | --- | --- | --- |
1393-
| 1 | Same reason | Windows | A (net8.0, x64) — attempt 1, session session-1 |
1394-
| 1 | Same reason | Windows | A (net8.0, x64) — attempt 2, session session-2 |
1395-
| 1 | Same reason | Windows | A (net9.0, x64) |
1396-
| 1 | Same reason | Windows | B (net8.0, x64) |
1463+
- **1 skipped** — Same reason
1464+
1465+
**Test module:** A (net8.0, x64) — attempt 1, session session-1 · **Platform:** Windows
1466+
1467+
- **1 skipped** — Same reason
1468+
1469+
**Test module:** A (net8.0, x64) — attempt 2, session session-2 · **Platform:** Windows
1470+
1471+
- **1 skipped** — Same reason
1472+
1473+
**Test module:** A (net9.0, x64) · **Platform:** Windows
1474+
1475+
- **1 skipped** — Same reason
1476+
1477+
**Test module:** B (net8.0, x64) · **Platform:** Windows
13971478
13981479
13991480
""".Replace("\r\n", "\n"),
@@ -1432,10 +1513,10 @@ public async Task SessionFinishing_GroupsSkipExplanationsWithoutListingSkippedNa
14321513
14331514
### Skipped tests by reason
14341515
1435-
| Skipped | Reason | Platform | Test module |
1436-
| ---: | --- | --- | --- |
1437-
| 2 | Known issue | {GetOperatingSystem()} | MyAssembly ({targetFramework}, {RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant()}) |
1438-
| 1 | Reason not provided | {GetOperatingSystem()} | MyAssembly ({targetFramework}, {RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant()}) |
1516+
**Test module:** MyAssembly ({targetFramework}, {RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant()}) · **Platform:** {GetOperatingSystem()}
1517+
1518+
- **2 skipped** — Known issue
1519+
- **1 skipped** — Reason not provided
14391520
14401521
> Duration history unavailable for the observed tests; current timings are not a historical baseline.
14411522

0 commit comments

Comments
 (0)