Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dotnet-dotcover ... dotnet run in a blazor wasm project does not cover clientside code #78876

Open
PlatypusK opened this issue Nov 26, 2022 · 6 comments
Labels
arch-wasm WebAssembly architecture area-VM-meta-mono
Milestone

Comments

@PlatypusK
Copy link

command run
dotnet-coverage collect -o "D:\output-dotnet-coverage.xml" --output-format xml dotnet run

Building...
info: Microsoft.Hosting.Lifetime[14]
Now listening on: https://localhost:7052/
info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://localhost:5052/
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
Content root path: D:\Workspace\Clone\InterestCalculator\InterestCalculator.Client
info: Microsoft.Hosting.Lifetime[0]
Application is shutting down...
Canceling...
Code coverage results: D:\output-dotnet-coverage.xml.

this will produce a coverage file of the serverside code, but no mention of clientside code even though both are running

Note that it seems like the client has issues connecting to the server as well when run in this fashion. The app runs fine if run with just dotnet run.

The idea here is to start a clientside app locally, then run e2e tests with coverage using playwright or similar frameworks. Is this a supported option?

@PlatypusK
Copy link
Author

Expected Behavior
Collecting coverage on a locally hosted clientside wasm blazor app when using dotnet run with the dotnet-coverage tool

Steps To Reproduce
Create dotnet wasm hosted project
run "dotnet-coverage collect -o "D:\output-dotnet-coverage.xml" --output-format xml dotnet run"
Do anything in the clientside on the browser
Check in the generated coverage xml file if it contains clientside coverage

Exceptions (if any)
No response

.NET Version
6.0.111

Anything else?
I realize it may take debug mode or similar to do this, so would love for some instructions on how to enable this. Looked extensively on the web for a way to get coverage for e2e clientside blazor, and found nothing so far. I would very much prefer a cli solution so that it can be done in a ci pipeline

@javiercn javiercn transferred this issue from dotnet/aspnetcore Nov 26, 2022
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Nov 26, 2022
@ghost
Copy link

ghost commented Nov 26, 2022

Tagging subscribers to this area: @dotnet/area-extensions-hosting
See info in area-owners.md if you want to be subscribed.

Issue Details

command run
dotnet-coverage collect -o "D:\output-dotnet-coverage.xml" --output-format xml dotnet run

Building...
info: Microsoft.Hosting.Lifetime[14]
Now listening on: https://localhost:7052/
info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://localhost:5052/
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
Content root path: D:\Workspace\Clone\InterestCalculator\InterestCalculator.Client
info: Microsoft.Hosting.Lifetime[0]
Application is shutting down...
Canceling...
Code coverage results: D:\output-dotnet-coverage.xml.

this will produce a coverage file of the serverside code, but no mention of clientside code even though both are running

Note that it seems like the client has issues connecting to the server as well when run in this fashion. The app runs fine if run with just dotnet run.

The idea here is to start a clientside app locally, then run e2e tests with coverage using playwright or similar frameworks. Is this a supported option?

Author: PlatypusK
Assignees: -
Labels:

area-Extensions-Hosting

Milestone: -

@radical
Copy link
Member

radical commented Nov 29, 2022

cc @TanayParikh

@steveharter steveharter added the arch-wasm WebAssembly architecture label Dec 5, 2022
@ghost
Copy link

ghost commented Dec 5, 2022

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

command run
dotnet-coverage collect -o "D:\output-dotnet-coverage.xml" --output-format xml dotnet run

Building...
info: Microsoft.Hosting.Lifetime[14]
Now listening on: https://localhost:7052/
info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://localhost:5052/
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
Content root path: D:\Workspace\Clone\InterestCalculator\InterestCalculator.Client
info: Microsoft.Hosting.Lifetime[0]
Application is shutting down...
Canceling...
Code coverage results: D:\output-dotnet-coverage.xml.

this will produce a coverage file of the serverside code, but no mention of clientside code even though both are running

Note that it seems like the client has issues connecting to the server as well when run in this fashion. The app runs fine if run with just dotnet run.

The idea here is to start a clientside app locally, then run e2e tests with coverage using playwright or similar frameworks. Is this a supported option?

Author: PlatypusK
Assignees: -
Labels:

arch-wasm, untriaged, area-Extensions-Hosting

Milestone: -

@lewing lewing added this to the Future milestone Jul 21, 2023
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Jul 21, 2023
@lewing
Copy link
Member

lewing commented Jul 21, 2023

This is an interesting case to consider @radical @maraf

@rodolfograve
Copy link

+1 ... We are also interested in this use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-wasm WebAssembly architecture area-VM-meta-mono
Projects
None yet
Development

No branches or pull requests

6 participants