Blazor support for `dotnet test`
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
.NET MAUI is adding support for `dotnet test`:
* https://github.com/dotnet/sdk/blob/main/documentation/specs/dotnet-run-for-maui.md
* https://github.com/dotnet/maui/pull/33117
* https://github.com/dotnet/android/issues/10683
* …
For example, with .NET 11 Preview 4 (hopefully), it should be possible to use `dotnet test` within a "properly configured Android project [^0]" 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 [^0].)
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.
[^0]: 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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.