How to correctly filter coverage results?
I have a build script in FAKE, which runs DotCoverNUnit with tests.
Currently dotCover coverage results includes all my project assemblies. I want to filter them out just to only one assembly, but can't figure out correct way of doing this.
Here's code snippet, which defines dotCover parameters:
let dotCoverParams =
(fun p -> { p with
ToolPath = dotCoverToolPath
Output = dotCoverFileName
Filters = "+:*My.Project.Core*;" })
Documentation says to filter like that:
+:assembly=*;type=*;method=***
Similar question on stackoverflow suggests different solution.
I've tried numerous variants, but none of them worked.
Also build log shows this message and I'm not sure what it means and if it is related to this problem at all:
[22:48:39]Generate dotCover HTML report (12s)
[22:48:44][Generate dotCover HTML report] 1,058 of 1,482 source files were not found under the build checkout directory C:\TeamCity\buildAgent\work\fea10e65e71888c9. Those files will not be included in dotCover report as source code of classes.
[22:48:44] [Generate dotCover HTML report] For example:
d:\buildagent-02\work\aa063b4295dfc097\src\masstransit\configuration\busserviceconfigurators\defaultbusserviceconfigurator.cs
d:\buildagent-02\work\aa063b4295dfc097\src\masstransit\pipeline\instancehandlerselector.cs
d:\buildagent-02\work\aa063b4295dfc097\src\transports\masstransit.transports.rabbitmq\configuration\configurators\passwordconnectionfactoryconfigurator.cs
d:\buildagent-01\work\e0c2e9549be9e701\src\stact\workflow\workflowdefinitionexception.cs
z:\builds\work\d21bade4fe20a99b\fluentassertions.core\primitives\stringvalidator.cs
Any ideas how to filter assembly correctly?
Please sign in to leave a comment.
Hello Andrew,
Sorry for the delay in replying. The filter is fine, but the value might not be passed to dotCover correctly. Could you please enable dotCover logs and send them to us? To do so, add the 'teamcity.agent.dotCover.log' configuration parameter to the build configuration with a path to an empty directory on the agent. All dotCover log files will be placed there and TeamCity will publish zipped logs as hidden build artifact: '.teamcity/.NETCoverage/dotCoverLogs.zip'.
Kind regards,
Maria
Hello Maria,
Thank you for your response.
I've enabled dotCover logs and attached them below.
Let me know if you have any updates on this issue!
Thank you,
Andrew
Attachment(s):
dotCoverLogs.zip
Hello Andrew,
There are no logs for the 'COVER' command in the archive attached. Without these logs we can't check whether filters are being passed correctly. Could you please send us such logs as well? If you use dotCover console runner, please add the following parameter to your command line: /LogFile=[path].
Kind regards,
Maria
Hello Maria,
Unfortunately, due to limitations of FAKE library I can't specify "LogFile" parameter. Any ideas why logs were not created for "cover" command?
Maybe some other files could help you determine the problem?
Hello Andrew,
TeamCity collects logs for the dotCover commands which it executes on its own.
In your case 'cover' command is executed via Fake script and TeamCity is only notified about the result.
Could you please share dotCover.snapshot file from the list you've sent?
It is not as useful as the log file for this purpose, but we'll be able to get some info from it as well.
Hello Ruslan,
I've attached dotCover.snapshot file below. Hope this helps.
Let me now if you have any updates regarding this issue.
Attachment(s):
dotCover.snapshot.zip
Hello Andrew,
It appears that FAKE script doesn't actually pass /Filters argument to dotCover command line.
I've created a pull request with fixes to this:
https://github.com/fsharp/FAKE/pull/618
It will help.
Hello Ruslan,
Thanks for investigation and the fix!
Now filters are working correctly!