Skip to content

[Feature] Add screenshot, video, tracing on/off/on-failure to NUnit/MSTest #2214

Open

Description

No description provided.

Activity

  1. enisak commented on Aug 29, 2022

    @enisak

    Any ETA for this please?

  2. mxschmitt commented on Aug 29, 2022

    @mxschmitt
    ContributorAuthor

    Any ETA for this please?

    enisak we can't give any official eta (but I think we are able to deliver it in 1.27 and maybe 1.26) it's the next thing I'm working on.

  3. markoueis commented on Dec 23, 2022

    @markoueis

    Hi Folks,
    Merry Christmas to all. I'm wondering if the plan for this feature request is to deliver it as a Christmas gift to all. But if not, do we have an ETA? Last ETA was 1.26 or 1.27. Looks like we are passed that now. Thank you

  4. akamud commented on Jan 13, 2023

    @akamud

    Just want to add that I use Playwright for automating scenarios other than e2e tests, so if this could be applied in Playwright itself and not Playwright.NUnit it would solve a request from me.
    Should I open a different issue or will this be addressed by this one?

  5. CameronMackenzie99 commented on Mar 15, 2023

    @CameronMackenzie99

    Being able to define the trace options via settings file that can be scoped by environment would be a very useful feature here. I guess it's part of a wider feature of being able to define playwright settings similarly to the JS version with environment scoped values. Currently using the .runsettings solution for running locally in VS but for running in CI it would be great to be able to have scoped settings.

  6. tesar-tech commented on Sep 9, 2023

    @tesar-tech

    Would you mind to share your current solution for such task?

    I have these two ideas:

    • Trace everything, but save only the failed cases.
    • Turn on tracing only on retries.
  7. TheJackGower commented on Jan 17, 2024

    @TheJackGower

    Any ETA for this please? 👍🏻

  8. gauravkhuraana commented on Feb 29, 2024

    @gauravkhuraana

    I think this feature is already there https://playwright.dev/dotnet/docs/trace-viewer-intro , am i missing anything ?

    To do it now.. we are using this workaround

    Start the trace always but stop it only if there is a failure or if the flag is set to capture it

        if(TestContext.CurrentContext.Result.Outcome.Status.ToString()=="failed" || tracingStatus = true)
        {
         // stop the trace
       }
    
  9. DanielHabenicht commented on Feb 29, 2024

    @DanielHabenicht

    Your link is linking to some other url.
    Regarding the question I would say the issue is 70% solved.

    There ist still no video capture functionality.

    Sorry misread the issue myself.
    This is about adding a functionality to only capture a trace when a test failed.

    Probably by repeating the test automatically and capturing the trace then. So there are only traces of failed tests.

  10. gauravkhuraana commented on Feb 29, 2024

    @gauravkhuraana

    Your link is linking to some other url. Regarding the question I would say the issue is 70% solved.

    There ist still no video capture functionality.

    Sorry misread the issue myself. This is about adding a functionality to only capture a trace when a test failed.

    Probably by repeating the test automatically and capturing the trace then. So there are only traces of failed tests.

    Edited my reply and included the workaround we are using, thanks for pointing the actual ask

  11. philip-reid-MP commented on Apr 2, 2025

    @philip-reid-MP

    Is there still a plan to introduce this or has it been mothballed?

  12. dcrousso commented on Oct 21, 2026

    @dcrousso
    Contributor

    Hi, the Playwright bot looked into this on my behalf.

    Valid feature request: automatic artifact retention is still missing from the NUnit and MSTest base classes. Screenshot, video, and tracing APIs already exist. The remaining feature is runner integration, not another capture API.

    The unresolved contract is what on-failure retains: every failed attempt, even if a retry later passes, or only tests whose final result fails, including setup or cleanup failures? A cleanup hook can use the outcome available then, but cannot know about an exception from a later cleanup. Traces and videos must start recording before the failure. Recording only on a retry captures a different attempt.

    For traces today, the official examples show setup and cleanup hooks for both runners: https://playwright.dev/dotnet/docs/trace-viewer-intro#recording-a-trace. Start tracing before the test, then always call Context.Tracing.StopAsync during cleanup. Supply Path to retain the trace and omit it to discard the trace. This is a manual workaround based on the outcome available at that hook, not a built in retention mode.

    Source evidence and remaining scope

    The bot reviewed current main and the official runner documentation. This was a source and documentation review only. No builds or tests were run.

    The full feature also needs a defined artifact destination and attachment policy, unique names for parallel tests and retry attempts, and a clear scope for additional pages and contexts. Existing capture APIs do not decide these runner policies.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions