Retry extension: final attempt's .trx is duplicated in results directory, causing double-counted attempts in Azure DevOps
メンテナーはふだん 1 日以内に返信
関連するプルリクエストがすでにマージされています。
- #12241 @Evangelink による — マージ済み
評価
調査の方向性
Start by tracing how Microsoft.Testing.Extensions.Retry writes per-attempt TRX files and copies the final attempt into the results directory; the issue does not name source files or tests. Reproduce with dotnet test --test-modules **/*.Tests.dll --results-directory "<dir>" --report-trx --retry-failed-tests 1 and an always-failing test. Done when publishing the generated files with **/*.trx reports each actual attempt once.
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
When using Microsoft.Testing.Extensions.Retry together with --report-trx, the retry extension writes one .trx per attempt to <results-directory>/Retries/<id>/<attempt>/, and additionally copies the .trx of the last attempt to <results-directory> itself.
When results are published to Azure DevOps with the common pattern **/*.trx (PublishTestResults@2), the last attempt is published twice. For failed or retried tests, Azure DevOps then shows one more attempt than actually happened:
- a test that was retried once shows three attempts, the last two being identical;
- a failed test that was not retried (e.g. because
--retry-failed-tests-max-percentagewas exceeded) shows Attempt 0 and Attempt 1 with identical results.
Tests that pass on the first try are shown only once.
This makes the test history misleading, especially for detecting flaky tests.
Version used
- .NET SDK 10.x,
dotnet testwith"test": { "runner": "Microsoft.Testing.Platform" }inglobal.json - NUnit via VSTestBridge (also applicable to MSTest/xUnit v3/TUnit but not tested)
- NUnit 5.0.0; NUnit3TestAdapter 6.3.1
- Microsoft.Testing.Extensions.Retry version: 2.5.2
- Azure DevOps
PublishTestResults@2,testResultsFormat: VSTest
Steps To Reproduce
dotnet test --test-modules **/*.Tests.dll --results-directory "<dir>" --report-trx --retry-failed-tests 1
with one test that always fails. Resulting files:
<dir>\MyTests_net10.0_x64.trx <- copy of last attempt
<dir>\Retries\Fx7uV\1\MyTests_net10.0_x64.trx <- attempt 1
<dir>\Retries\Fx7uV\2\MyTests_net10.0_x64.trx <- attempt 2
Note that the copy in <dir> is not listed under "In process file artifacts produced" in the console output.
Expected behavior
Test has Attempt# 0 and Attempt# 1 when retried
Actual behavior
Test has Attempt# 0, Attempt# 1 ánd Attempt# 2 when retried
Additional context
Questions:
- Is copying the final attempt's results to the root of the results directory intended behavior? If so, could this be documented?
- What is the recommended way to publish results to Azure DevOps so that every actual attempt is reported exactly once? Publishing
Retries/**/*.trxwhen retries are enabled and*.trxotherwise works, but requires conditional logic in every pipeline. - Would you consider an option to control this, for example writing only the per-attempt files, or only a single merged
.trxthat contains all attempts?
- 主要言語
- C#
- スター
- 1.1k
- フォーク
- 314
- 平均マージ
- 11時間 9分
- マージ済み PR(30日)
- 340
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/testfx のほかの issue
-
type/breaking-change
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
メンテナーはふだん 1 日以内に返信
-
Remove obsolete MSTest 5 and Microsoft.Testing.Platform 3 compatibility APIs and configuration aliases対応中かも @Evangelink が今日担当しました。 オープンtype/breaking-change
microsoft/testfx#12312 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
area/analyzers area/assertion
難易度 3/5 1〜2日 初心者へのやさしさ 56/100
microsoft/testfx#12260 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
area/assertion needs/triage
難易度 5/5 1週間以上 初心者へのやさしさ 42/100
メンテナーはふだん 1 日以内に返信
-
type/automation type/test-gap
難易度 3/5 半日 初心者へのやさしさ 15/100
メンテナーはふだん 1 日以内に返信
microsoft/testfx の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
RadicalCSG/com.chisel#312 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 63/100
DeveloperAcademy-POSTECH/2026-C6-M10-MUSA#677 ·
メンテナーはふだん 1 日以内に返信
-
REQ-13 : une demande En cours perd son responsable par un simple enregistrement, et reste En coursオープンa-corriger bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
christian-raj/S-Aloha#301 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
.NET Docs Next Major State: Needs Discussion
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
getsentry/sentry-dotnet#5912 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信