# Retry flaky tests with dotnet test and PowerShell

DevFeed: [Retry flaky tests with dotnet test and PowerShell](<https://devfeed.tech/articles/retry-flaky-tests-with-dotnet-test-and-powershell-20782.md>)

Original publisher: [Read original article](<https://conductofcode.io/post/retry-flaky-tests-with-dotnet-test-and-powershell/>)

Author: {"twitter"=\>"hlaueriksson"}

Published: 2023-03-26T19:00:00Z

Content type: tutorial

Language: en

Sources: [Henrik Lau Eriksson](<https://devfeed.tech/sources/henrik-lau-eriksson.md>)

Topics: [PowerShell](<https://devfeed.tech/topics/powershell.md>), [.NET](<https://devfeed.tech/topics/net.md>), [Command-line interface](<https://devfeed.tech/topics/cli.md>), [Smoke Tests](<https://devfeed.tech/topics/smoke-tests.md>), [Playwright](<https://devfeed.tech/topics/playwright.md>), [Selenium](<https://devfeed.tech/topics/selenium.md>)

Tags: [c-sharp](<https://devfeed.tech/tags/c-sharp.md>), [cli](<https://devfeed.tech/tags/cli.md>), [configuration](<https://devfeed.tech/tags/configuration.md>), [dotnet](<https://devfeed.tech/tags/dotnet.md>), [flaky](<https://devfeed.tech/tags/flaky.md>), [jenkins](<https://devfeed.tech/tags/jenkins.md>), [mstest](<https://devfeed.tech/tags/mstest.md>), [nunit](<https://devfeed.tech/tags/nunit.md>), [playwright](<https://devfeed.tech/tags/playwright.md>), [powershell](<https://devfeed.tech/tags/powershell.md>), [retry](<https://devfeed.tech/tags/retry.md>), [selenium](<https://devfeed.tech/tags/selenium.md>), [test](<https://devfeed.tech/tags/test.md>), [testing](<https://devfeed.tech/tags/testing.md>), [unit-tests](<https://devfeed.tech/tags/unit-tests.md>), [xunit](<https://devfeed.tech/tags/xunit.md>)

## AI overview

This tutorial presents a PowerShell script that uses dotnet test and TRX result files to track failed tests, retry them, report the final result, and allow a configured percentage of failures. It demonstrates the script with NUnit, MSTest, and xUnit.

## Source excerpt

Introducing test.ps1, a script for running flaky tests - Keeps track of failing tests and retries them - Notifies the test framework of the current retry iteration - Makes it possible to accept a certain percentage of failing tests - Outputs the test result in a coherent way