How to exclude Projects with names ending in “.Test” from my code coverage analysis in VS2012 Unit Tests

前端 未结 2 497
悲哀的现实
悲哀的现实 2020-12-28 13:30

My solution is set up with projects called \"ProjectName\" with \"ProjectName\".Tests containing my unit tests. I\'d like to exclude the test projects from the code coverage

相关标签:
2条回答
  • 2020-12-28 14:02

    There is a connection with the period issue as it was mentioned here. If you change the exclude section to this

    <ModulePath>.*tests.dll</ModulePath>
    <ModulePath>.*Tests.dll</ModulePath>
    

    or this

    <ModulePath>.*\.tests\..*</ModulePath>
    <ModulePath>.*\.Tests\..*</ModulePath>
    

    it'll work

    0 讨论(0)
  • 2020-12-28 14:14

    You can exclude it by excluding the project dll or by using project name itself also. E.g. -

    <ModulePaths>
     <Exclude>
      <ModulePath>Fabrikam.Math.UnitTest.dll</ModulePath>  
        <!-- You can add more ModulePath nodes here. -->
     </Exclude> 
    </ModulePaths>
    

    This MSDN link is useful for it.

    0 讨论(0)
提交回复
热议问题