Skip to content

Blazor support for dotnet test #54091

@jonpryor

Description

@jonpryor

.NET MAUI is adding support for dotnet test:

For example, with .NET 11 Preview 4 (hopefully), it should be possible to use dotnet test within a "properly configured Android project 1" which will:

  1. Launch an emulator (if an emulator configuration already exists)
  2. Install the app
  3. Run the unit tests within the app
  4. Extract the resulting .trx file from the device
  5. Close the emulator

((1), (2), (3-ish), and (5) are done in .NET 11 Preview 3 for dotnet run; dotnet test support is still ongoing.)

It would be nice if the same workflow could be applied to blazorwasm projects

  1. Create blazorwasm app which contains unit tests. (Again, see 1.)
  2. dotnet test:
    1. runs dotnet run (which starts a local server hosting the blazorwasm project),
    2. launches a web browser (possibly with --headless) connecting to the URL from (1)
    3. runs the tests
    4. extracts the test results
    5. closes the web browser

The browser to use for testing should be configurable and overridable via command-line arguments.

Footnotes

  1. The definition of "properly configured project" is not as well defined as I'd like. .NET 11 Preview 4's dotnet test for Android will launch and wait for an Instrumentation, which will have the "required glue code" to make the magic happen. 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions