Using .runsettings to exclude assemblies from code coverage

前端 未结 5 983
孤城傲影
孤城傲影 2020-12-09 03:40

When running code coverage for my solution which contains multiple projects, I noticed that Code Coverage includes also my test assemblies.

I found an article which

5条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-09 04:31

    On a related note, I ran into this post because I was bit thinking clearly about the regular expression nature of the include and exclude paths. For my WPF application, I wanted to exclude coverage analysis on Caliburn.Micro. So I had written

    Caliburn.Micro.dll
    

    Clearly, the period is messing me up. This question does not suffer from that problem, but I bet I’m not the only one to overlook this simple fact. For any other readers, please also take note that * is not a wildcard – it is the regular expression “any number of” operator. You do not want *.Caliburn, but rather .*Caliburn Thus this simple statement solved my problem:

    .*Caliburn.*
    

    Because it is looking for a path, not just a module name, you need the .* in front of the module to ignore it – that is, you want to ignore it at any given file path.

提交回复
热议问题