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

Running coverlet as a tool doesn't detect Test assembly correctly #44

Open
charlessolar opened this issue May 17, 2021 · 3 comments
Open
Labels
question Further information is requested

Comments

@charlessolar
Copy link

charlessolar commented May 17, 2021

I use this extension to launch the coverlet tool (not MSBuild version) and discovered that it appears the argument customization for coverlet needs a little tweak

The code is looking for the test dll using the provided configuration - but the way it passed it to the process doesn't work due to either coverlet or dotnet test - I dont know which.

Take for example this is how coverlet is currently run via this extension

coverlet --target dotnet --targetargs "test --no-build" .\bin\**Release**\netcoreapp3.1\Aggregates.NET.UnitTests.dll

however this doesn't work

Test run for C:\Projects\Common\Aggregates.NET\src\Aggregates.NET.UnitTests\bin\**Debug**\netcoreapp3.1\Aggregates.NET.UnitTests.dll (.NETCoreApp,Version=v3.1)
Microsoft (R) Test Execution Command Line Tool Version 16.8.3
Copyright (c) Microsoft Corporation.  All rights reserved.
The test source file "C:\\Projects\Common\Aggregates.NET\src\Aggregates.NET.UnitTests\bin\**Debug**\netcoreapp3.1\Aggregates.NET.UnitTests.dll" provided was not found.

For some reason even though you provide the test assembly its still trying to detect it - and incorrectly assumes Debug configuration.

The fix is to supply --configuration Release to dotnet test via target args

like so

coverlet --target dotnet --targetargs "test --no-build --configuration Release" .\Aggregates.NET.UnitTests.csproj

@Romanx
Copy link
Owner

Romanx commented May 17, 2021

This looks like you're using coverlet directly rather than using this extension for cakebuild. Do you have an example cake file that we can look at?

@Romanx Romanx added the question Further information is requested label May 17, 2021
@charlessolar
Copy link
Author

heres a repo for this just follow the cake steps

the root problem is coverlet tool is using dotnet test but not figuring out to set --configuration so dotnet test is choosing debug by default.

If i was manually running the tool this is easy to fix so I don't think its a bug with coverlet - I think its a bug here because through cake and this extension i have no access to change the parameters to coverlet.

Something as simple as adding a Configuration property to CoverletSettings should suffice very nicely!

@TerryChan2
Copy link

Hi, any update for the above problem for setting the configuration to release? We encountered the same problem even we are using cake.coverlet 3.0.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants