You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Retries would be for the whole project, so you can define <Retries>1</Retries> inside your runsettings file or when defining it via --settings to dotnet test. This is the same way how it's done for Node.js.
Just a question out of curiosity, are you using NUnit or MSTest?
Depending on the comments provided, I think it is clear that this should have priority. I hope it will be implemented soon, we really need this, Thanks a lot
Latest MSTest already provides a RetryAttribute for test methods. And for advanced scenarios where the features of RetryAttribute aren't enough, you can implement your own implementation based on RetryBaseAttribute.
Hi, the Playwright bot investigated this on my behalf.
This remains a valid request for a shared Playwright .NET retry policy. Actionability waiting and assertion polling already exist, but neither reruns a failed test. The old retry attributes were deliberately withdrawn, and restoring them would also restore unresolved lifecycle and timeout behavior.
Should this issue define a project wide Playwright policy across the supported runners, or document the retry facilities those runners now provide? That decision should precede another implementation.
Current behavior and available runner options
The Playwright NUnit, MSTest, xUnit, and xUnit v3 integrations provide fixtures, not a common retry setting. PlaywrightSettingsProvider has no retry accessor. XML <Retries> reaches the unsupported setting diagnostic, although an unused PlaywrightSettingsXml.Retries property remains. The retry command in Playwright.Tests/Attributes/PlaywrightTestAttribute.cs is for this repository's CI tests, not a public adapter feature.
Catching a failed NUnit assertion and repeating a method is insufficient. NUnit records assertion failures in the current result before throwing. Its retry command creates a fresh result before the next attempt. The removed Playwright NUnit wrapper used IWrapTestMethod, so it did not wrap setup and teardown for every attempt.
chore: make retries work with custom timeouts #2319 attempted timeout and lifecycle support but closed without merging. Its review explicitly identified incomplete MSTest cleanup and dependence on NUnit internals.
A shared policy needs agreed attempt counts, eligible failures, setup and cleanup boundaries, timeout cancellation before restarting, fresh browser contexts and NUnit assertion results, and reporting of recovered and exhausted attempts. Existing adapter tests in src/Playwright.TestingHarnessTest/tests/ provide the integration harness for validating that contract.
Evidence and validation limits
Source and history were inspected on local main at 9eac4c84, package version 1.64.0. All 21 issue comments and the paginated timeline were read, together with linked PR discussions, official documentation, and NUnit source. Source was unchanged. No builds or tests were run, no dependencies were installed, and no reporter projects were executed. Runner APIs above were verified from documentation and source, not by running compatibility tests with Playwright.
Activity
bheemreddy181 commentedon Sep 19, 2022
Really looking forward into this - we are missing retries at this moment
bheemreddy181 commentedon Sep 19, 2022
Can we also make retries differ based on the tag - like say if we have API tests then set retries to 0 and set retries to number n for web tests ?
mxschmitt commentedon Sep 19, 2022
Retries would be for the whole project, so you can define
<Retries>1</Retries>inside your runsettings file or when defining it via--settingstodotnet test. This is the same way how it's done for Node.js.Just a question out of curiosity, are you using NUnit or MSTest?
bheemreddy181 commentedon Sep 19, 2022
We are using Nunit - makes sense you can ignore the tag request. It’s better to have different run settings for different tag runs
nicolaiarocci commentedon Mar 21, 2023
Looking forward to this one too.
masaplecas commentedon Mar 27, 2023
Is there any ETA about this one?
DavinderZilo commentedon Mar 30, 2023
Any update on this, it will really help where tests at times fail duty flakey backend
3 remaining items
gauravkhuraana commentedon Feb 29, 2024
Dotnet is lagging compared to nodejs in many perspective. Can we please bring it to speed and bring on these features
ashleybissell commentedon Apr 10, 2024
Do we have any timescales for when this might be looked at again? It appears to be a popular issue and would be a big help to a lot of users.
ertiusmeo commentedon May 29, 2024
Is there any plan for this feature? It would be nice to have it.
mxschmitt commentedon May 29, 2024
ertiusmeo we are actively exploring options for NUnit and MSTest and collaborate with the MSTest maintainers. (no eta unfortunately)
Ozkanil commentedon Jan 9, 2025
Hello Max Schmitt (@mxschmitt) is there any update on retry support for .net? Thanks!
jfuinsure commentedon Jan 20, 2025
Any updates?
mattvb91 commentedon Jan 27, 2025
Looks like this is dead so we have no other option than to go to cypress. How is anyone using this in a CI CD environment currently?
ac-ekm commentedon Jan 31, 2025
Until the feature is implemented, the following workarounds are available. Perhaps it might help someone.
dotnet-test-rerun
Rerun with Powershell script
HakamFostok commentedon Jun 30, 2025
Depending on the comments provided, I think it is clear that this should have priority. I hope it will be implemented soon, we really need this, Thanks a lot
Youssef1313 commentedon Jul 3, 2025
Latest MSTest already provides a RetryAttribute for test methods. And for advanced scenarios where the features of
RetryAttributearen't enough, you can implement your own implementation based onRetryBaseAttribute.alexaka1 commentedon Jul 4, 2025
Fwiw I have had great success with
Microsoft.Testing.Platformretry extension. https://learn.microsoft.com/en-us/dotnet/core/testing/microsoft-testing-platform-extensions-policydcrousso commentedon Oct 21, 2026
Hi, the Playwright bot investigated this on my behalf.
This remains a valid request for a shared Playwright .NET retry policy. Actionability waiting and assertion polling already exist, but neither reruns a failed test. The old retry attributes were deliberately withdrawn, and restoring them would also restore unresolved lifecycle and timeout behavior.
Should this issue define a project wide Playwright policy across the supported runners, or document the retry facilities those runners now provide? That decision should precede another implementation.
Current behavior and available runner options
PlaywrightSettingsProviderhas no retry accessor. XML<Retries>reaches the unsupported setting diagnostic, although an unusedPlaywrightSettingsXml.Retriesproperty remains. The retry command inPlaywright.Tests/Attributes/PlaywrightTestAttribute.csis for this repository's CI tests, not a public adapter feature.[Retry(n)]retries assertion failures, not errors fromPlaywrightExceptionorSystem.TimeoutException. Playwright assertions throw the former, and action timeouts use the latter. NUnit 4.5 addedRetryExceptionsto opt into specified exception types. Itsncounts total attempts, not additional retries. See https://docs.nunit.org/articles/nunit/writing-tests/attributes/retry.html and https://github.com/nunit/nunit/blob/v4.5.1/src/NUnitFramework/framework/Attributes/RetryAttribute.cs. Playwright's NUnit package still declares NUnit 3.13.2 as its minimum dependency.IWrapTestMethod, so it did not wrap setup and teardown for every attempt.RetryAttributeandRetryBaseAttribute. The original Playwright MSTest package declares older framework dependencies, whileMicrosoft.Playwright.MSTest.v4targets the newer framework. See https://learn.microsoft.com/en-us/dotnet/core/testing/unit-testing-mstest-writing-tests-controlling-execution#retry-attributes.--retry-failed-tests. This is not a Playwright setting or an option automatically available in existing VSTest projects. See https://learn.microsoft.com/en-us/dotnet/core/testing/microsoft-testing-platform-retry.Implementation history and remaining design work
src/Playwright.TestingHarnessTest/tests/provide the integration harness for validating that contract.Evidence and validation limits
Source and history were inspected on local
mainat9eac4c84, package version 1.64.0. All 21 issue comments and the paginated timeline were read, together with linked PR discussions, official documentation, and NUnit source. Source was unchanged. No builds or tests were run, no dependencies were installed, and no reporter projects were executed. Runner APIs above were verified from documentation and source, not by running compatibility tests with Playwright.The distinct action and assertion behavior is documented at https://playwright.dev/dotnet/docs/actionability and https://playwright.dev/dotnet/docs/test-assertions.
dgozman commentedon Nov 10, 2026
Documented existing retry facilities for .net test runners in microsoft/playwright#43920. Not planning to introduce retries into playwright code.