Skip to content

show summary of retried and flaky tests #5362

Closed
Closed

Description

@nohwnd

Summary

When we retried a test, show list of tests that needed to be retried to the user if they specify

--show-retried-tests

When we retried a test and it succeeded, show the list of such tests to the user if they specify

--show-flaky-tests

Background and Motivation

users want to know which tests are potentially flaky, and might want to have easy overview of what tests failed and were retried at least once.

Caveat is that we have folded dynamic tests, and these tests will re-run all tests including tests that prevoiusly passed, so they will appear among flaky tests, and we cannot identify them better because testnodeuid is not unique per such tests, but per the test method that produces multiple results.

Activity

  1. added
    external/dotnet-test
    on Apr 2, 2025
  2. nohwnd commented on Apr 8, 2025

    @nohwnd
    MemberAuthor

    After looking into this a bit more, this is complicated by the fact that some tests can re-run and always succeed because of how folded tests work. At the same time we don't have enough information about those tests to be able to tell them apart, and link together only results that have the same source data. So some of the tests can pass when, and some other tests with other data can fail, and we don't know which is which.

  3. nohwnd commented on Apr 8, 2025

    @nohwnd
    MemberAuthor

    Sam Harwell (@sharwell) I am tracking the ask you had here. I will have to come back to it later, it is not as simple as I thought to make it reliable.

    But when we do have a report of the flaky tests, would it still be useful enough if we just print a list of those tests into results? We don't have a category for that in trx format AFAIK, or UI in azdo. And we don't have a new test report format yet, that would be able to communicate this.

  4. added
    area/mtp
    area/mtp-extensions
    on Jan 17, 2026
  5. Evangelink commented on Jul 30, 2026

    @Evangelink
    Member

    Implemented by #10329 (merged to main).

    The retry summary now reports flaky tests by name, gated by --show-flaky-tests (on/off, on by default):

    Retry summary: Passed! after 2/4 attempts
      total: 3
      failed: 0
      succeeded: 3
      skipped: 0
      flaky: 1 (passed after retry)
      retried: 1 test(s), 1 extra run(s)
      duration: 854ms
    
    Flaky tests:
      TestMethod1 (failed -> passed)
    

    On the caveat raised above about folded data-driven tests: attribution is per TestNodeUid, so a folded test counts once. That is the same rule Microsoft.Testing.Extensions.CtrfReport already implements, and it is documented rather than worked around.

    No separate --show-retried-tests option was added: retried tests are counted on the retried: line, but retried-but-never-recovered tests are not listed by name because the last attempt already reports them as failures with their full error output.

    The remaining halves are tracked separately:

    Closing as completed; please reopen if the named list of retried (as opposed to flaky) tests is still wanted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area/mtparea/mtp-extensionsexternal/dotnet-test

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions