recommended approach of adding altcover to test-projects (for ci build only) #221
-
Hey @SteveGilham , first of all: thanks for this alternative code coverage approach 🙏🏼 we are working with a large code base with lots of unit tests and were using coverlet with cobertura format before. executing the tests and measuring the code coverage took us really long (up to 15 minutes) - switching to altcover boosts up to 60% and we are now running in under 5 minutes - that's totally amazing - thanks! what we want to do is: measure code coverage only during our ci build what is not really clear to us is - which assemblies are instrumented and when. the docs says:
but what are those test-project.csproj:
we tried to add altcover during ci build only with dotnet custom (add package) command but that failed with the central package mamanagement we have: task:
error during dotnet restore:
only during ci build the msbuild parameter is set: we are now wondering if this is an approach to go or if that might have an impact on our releases (the deployed assemblies) as they might get instrumented (by just having the altcover package added). or if there is any better approach to only have it instrumented during ci build. we actually would love to do the dotnet add package approach as any newly added test project will get automatically a reference to altcover - maybe any one else has a solution for the cpm error? thanks for helping and again thanks for the project and your time and effort you've put into! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
The The "assemblies of interest" are the ones in the specified input directory that pass the supplied filters when the command line tool/MSBuild task/API call is invoked; with no filters meaning "all of them". In the case of the integration with When the instrumentation process is run on a build machine, where the source is available, then the best first filter is using the |
Beta Was this translation helpful? Give feedback.
-
Thanks for your quick reply and your detailed explanation - I was indeed able to get |
Beta Was this translation helpful? Give feedback.
The
NU1008
error is a consequence ofdotnet add package
blindly inserting a versioned reference entry into the project, and not doing anything fancy by way of looking for an overriding central package file. If you addaltcover
to the central package version management file, and then only add it to the test projects on the CI machine ahead of testing, then it inserts an unversioned package reference that won't provoke that error, but will be inert otherwiseThe "assemblies of interest" are the ones in the specified input directory that pass the supplied filters when the command line tool/MSBuild task/API call is invoked; with no filters meaning "all of them". In the case of the integration…