Skip to content

Commit a39964c

Browse files
EvangelinkCopilot
andauthored
[rel/4.5] Improve readability of Azure DevOps skip summaries (#12246)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 75ba0fc commit a39964c

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 (net8.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 (net8.0, {architecture}) |
121+
**Test module:** AzureDevOpsSummaryBehavior (net8.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
@@ -1026,9 +1026,9 @@ public void BuildAggregateMarkdown_RendersOneGlobalTopTenWithOutcomesAndElapsedT
10261026
10271027
### Skipped tests by reason
10281028
1029-
| Skipped | Reason | Platform | Test module |
1030-
| ---: | --- | --- | --- |
1031-
| 1 | Tracked issue | Linux | Beta (net8.0, x64) |
1029+
- **1 skipped** — Tracked issue
1030+
1031+
**Test module:** Beta (net8.0, x64) · **Platform:** Linux
10321032
10331033
### Test modules
10341034
@@ -1218,9 +1218,9 @@ public void BuildMarkdown_RendersTimedSkippedOutcome()
12181218
12191219
### Skipped tests by reason
12201220
1221-
| Skipped | Reason | Platform | Test module |
1222-
| ---: | --- | --- | --- |
1223-
| 1 | Known issue | {GetOperatingSystem()} | Tests (net8.0, unknown) |
1221+
**Test module:** Tests (net8.0, unknown) · **Platform:** {GetOperatingSystem()}
1222+
1223+
- **1 skipped** — Known issue
12241224
12251225
> Duration history unavailable for the observed tests; current timings are not a historical baseline.
12261226
@@ -1268,10 +1268,55 @@ public void BuildAggregateMarkdown_SkipReasonsEscapeCellsAndPreserveLegacyMetada
12681268
"""
12691269
### Skipped tests by reason
12701270
1271-
| Skipped | Reason | Platform | Test module |
1272-
| ---: | --- | --- | --- |
1273-
| 3 | Skip reason unavailable (older fragment) | Unavailable | Legacy (net8.0, arm64) |
1274-
| 2 | https://example.test/issues/42 \| \`reason\` &lt;pending&gt;&amp;<br>next | Linux\|&lt;runner&gt; | A\|&lt;&amp;&gt; (net8.0, x64) |
1271+
- **3 skipped** — Skip reason unavailable (older fragment)
1272+
1273+
**Test module:** Legacy (net8.0, arm64) · **Platform:** Unavailable
1274+
1275+
- **2 skipped** — https://example.test/issues/42 \| \`reason\` &lt;pending&gt;&amp;<br>next
1276+
1277+
**Test module:** A\|&lt;&amp;&gt; (net8.0, x64) · **Platform:** Linux\|&lt;runner&gt;
1278+
1279+
1280+
""".Replace("\r\n", "\n"),
1281+
GetSection(markdown, "### Skipped tests by reason"));
1282+
}
1283+
1284+
[TestMethod]
1285+
public void BuildAggregateMarkdown_SingleModuleSkipReasonsShareContext()
1286+
{
1287+
var module = new CiRunSummaryModule
1288+
{
1289+
AssemblyName = "Microsoft.Testing.Extensions.UnitTests",
1290+
TargetFramework = "net10.0",
1291+
Architecture = "x64",
1292+
OperatingSystem = "Linux",
1293+
TotalTests = 3,
1294+
SkippedTests = 3,
1295+
SkipReasons =
1296+
[
1297+
new CiRunSummarySkipReason
1298+
{
1299+
Reason = "Packaged Windows apps are a Windows-only scenario; the launcher is intentionally disabled elsewhere.",
1300+
Count = 2,
1301+
},
1302+
new CiRunSummarySkipReason
1303+
{
1304+
Reason = "Awaiting <package> & \"native\" support | see https://example.test/issues/314",
1305+
Count = 1,
1306+
},
1307+
],
1308+
};
1309+
1310+
string markdown = AzureDevOpsSummaryReporter.BuildAggregateMarkdown(CreateObservedAggregate(module));
1311+
1312+
Assert.AreEqual(
1313+
"""
1314+
### Skipped tests by reason
1315+
1316+
**Test module:** Microsoft.Testing.Extensions.UnitTests (net10.0, x64) · **Platform:** Linux
1317+
1318+
- **2 skipped** — Packaged Windows apps are a Windows-only scenario; the launcher is intentionally disabled elsewhere.
1319+
- **1 skipped** — Awaiting &lt;package&gt; &amp; &quot;native&quot; support \| see https://example.test/issues/314
12751320
12761321
12771322
""".Replace("\r\n", "\n"),
@@ -1314,18 +1359,45 @@ public void BuildAggregateMarkdown_SkipReasonsCapsRowsAndAccountsForObservedOmis
13141359
"""
13151360
### Skipped tests by reason
13161361
1317-
| Skipped | Reason | Platform | Test module |
1318-
| ---: | --- | --- | --- |
1319-
| 3 | Primary | macOS | Beta (net9.0, arm64) |
1320-
| 2 | Reason0 | Windows | Alpha (net8.0, x64) |
1321-
| 2 | Reason1 | Windows | Alpha (net8.0, x64) |
1322-
| 2 | Reason2 | Windows | Alpha (net8.0, x64) |
1323-
| 2 | Reason3 | Windows | Alpha (net8.0, x64) |
1324-
| 2 | Reason4 | Windows | Alpha (net8.0, x64) |
1325-
| 2 | Reason5 | Windows | Alpha (net8.0, x64) |
1326-
| 2 | Reason6 | Windows | Alpha (net8.0, x64) |
1327-
| 2 | Reason7 | Windows | Alpha (net8.0, x64) |
1328-
| 2 | Reason8 | Windows | Alpha (net8.0, x64) |
1362+
- **3 skipped** — Primary
1363+
1364+
**Test module:** Beta (net9.0, arm64) · **Platform:** macOS
1365+
1366+
- **2 skipped** — Reason0
1367+
1368+
**Test module:** Alpha (net8.0, x64) · **Platform:** Windows
1369+
1370+
- **2 skipped** — Reason1
1371+
1372+
**Test module:** Alpha (net8.0, x64) · **Platform:** Windows
1373+
1374+
- **2 skipped** — Reason2
1375+
1376+
**Test module:** Alpha (net8.0, x64) · **Platform:** Windows
1377+
1378+
- **2 skipped** — Reason3
1379+
1380+
**Test module:** Alpha (net8.0, x64) · **Platform:** Windows
1381+
1382+
- **2 skipped** — Reason4
1383+
1384+
**Test module:** Alpha (net8.0, x64) · **Platform:** Windows
1385+
1386+
- **2 skipped** — Reason5
1387+
1388+
**Test module:** Alpha (net8.0, x64) · **Platform:** Windows
1389+
1390+
- **2 skipped** — Reason6
1391+
1392+
**Test module:** Alpha (net8.0, x64) · **Platform:** Windows
1393+
1394+
- **2 skipped** — Reason7
1395+
1396+
**Test module:** Alpha (net8.0, x64) · **Platform:** Windows
1397+
1398+
- **2 skipped** — Reason8
1399+
1400+
**Test module:** Alpha (net8.0, x64) · **Platform:** Windows
13291401
13301402
> 9 additional skipped tests are not shown.
13311403
@@ -1358,12 +1430,21 @@ public void BuildAggregateMarkdown_SkipReasonTiesUseModuleFrameworkAndAttemptIde
13581430
"""
13591431
### Skipped tests by reason
13601432
1361-
| Skipped | Reason | Platform | Test module |
1362-
| ---: | --- | --- | --- |
1363-
| 1 | Same reason | Windows | A (net8.0, x64) — attempt 1, session session-1 |
1364-
| 1 | Same reason | Windows | A (net8.0, x64) — attempt 2, session session-2 |
1365-
| 1 | Same reason | Windows | A (net9.0, x64) |
1366-
| 1 | Same reason | Windows | B (net8.0, x64) |
1433+
- **1 skipped** — Same reason
1434+
1435+
**Test module:** A (net8.0, x64) — attempt 1, session session-1 · **Platform:** Windows
1436+
1437+
- **1 skipped** — Same reason
1438+
1439+
**Test module:** A (net8.0, x64) — attempt 2, session session-2 · **Platform:** Windows
1440+
1441+
- **1 skipped** — Same reason
1442+
1443+
**Test module:** A (net9.0, x64) · **Platform:** Windows
1444+
1445+
- **1 skipped** — Same reason
1446+
1447+
**Test module:** B (net8.0, x64) · **Platform:** Windows
13671448
13681449
13691450
""".Replace("\r\n", "\n"),
@@ -1402,10 +1483,10 @@ public async Task SessionFinishing_GroupsSkipExplanationsWithoutListingSkippedNa
14021483
14031484
### Skipped tests by reason
14041485
1405-
| Skipped | Reason | Platform | Test module |
1406-
| ---: | --- | --- | --- |
1407-
| 2 | Known issue | {GetOperatingSystem()} | MyAssembly ({targetFramework}, {RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant()}) |
1408-
| 1 | Reason not provided | {GetOperatingSystem()} | MyAssembly ({targetFramework}, {RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant()}) |
1486+
**Test module:** MyAssembly ({targetFramework}, {RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant()}) · **Platform:** {GetOperatingSystem()}
1487+
1488+
- **2 skipped** — Known issue
1489+
- **1 skipped** — Reason not provided
14091490
14101491
> Duration history unavailable for the observed tests; current timings are not a historical baseline.
14111492

0 commit comments

Comments
 (0)