Merging coverage output with the NuGET dotCover console runner
Hello
I'm having some issues trying to merge multiple coverage reports from the dotCover CLI console runner. I have set-up the console runner as instructed here (https://www.jetbrains.com/help/dotcover/Running_Coverage_Analysis_from_the_Command_LIne.html#using-dotnet-exe-to-run-coverage-analysis-of-unit-tests) so that the console runner can run as part of a build pipeline within Linux containers. The software being built spans multiple projects and I have been able to successfully create unit test code coverage reports for each of my projects.
My issue starts when attempting to merge these multiple reports into one report. I cannot seem to get the 'merge' command to work when using the console runner. I have tried the following commands:
dotnet dotcover merge --dcSource="path-to-source-files-semicolon-separated" --dcOutput="name-of-output"
This results in the message "Not used command line parameter: 'Source'" followed by the message "Could not execute because the specified command or file was not found". The above was also tried without quotes around the file paths and output name and yielded the same result
I've looked at the commands inside of dotnet dotcover help which shows nothing in the way of a merge command, even though the documentation above states that the console runner does have the command available.
What is the correct syntax to use for the merge command in the console runner to merge multiple coverage reports? Thanks in advance for any help.
Console runner version: 2019.3.1
Please sign in to leave a comment.
Hello,
When you use a command like dotnet dotcover test like it is mentioned on the page you linked then the command is parsed like dotnet test and executed under dotcover. Hence when you write dotnet dotcover merge it is trying to run dotnet merge which does not make sense. Please find more information here.
To merge snapshots, please use the following instruction. Let me know if you have other questions.
Hi Olga
Many thanks for your reply. What would be the correct syntax to use to merge snapshots created with dotnet dotcover test? The instructions linked are unclear on how to use the merge command when dotCover is being used as a DotNetCliToolReference. I've tried the following:
dotnet dotcover test --dcMerge --dcSource="path-to-source-files-semicolon-separated" --dcOutput="name-of-output"
This results in the messages
"Not used command line parameter: 'Merge'"
"Not used command line parameter: 'Source'"
The file output from this isn't a merged snapshot, it's the output of a single project's code coverage report from where the CLI was ran. Many thanks in advance.
To merge the snapshots you should run dotcover merge, without dotnet like it is described here. There are not such parameters you are trying to use, the command dotnet merge does not exist.
Hi Olga
Thanks for getting back, I've tried running dotcover merge as described in the linked article however this appears to be documentation for the .exe tool as opposed to the DotNetCliToolReference tool. When I run dotcover merge inside my unit test project with the DotNetCliToolReference dotCover tool installed I get the message "bash: dotcover: command not found". This makes sense because I haven't got dotcover registered as a system/environment variable, it's being used as a DotNetCliToolReference tool.
Please find below output of running dotcover merge inside a project with the DotNetCliToolReference tool installed:
Is there any documentation which covers merging with the DotNetCliToolReference tool? Or do I need to do something else to get the dotcover merge command to work as expected with the DotNetCliToolReference tool?
I am also having the same issue, I wanted to use the DotNetCliToolReference to merge snapshots
Eidemetriou - I raised a youtrack issue for this:
https://youtrack.jetbrains.com/issue/DCVR-10307