MSTest + Visual Studio generates accessors which appear on the NCover coverage report. They usually have a low coverage in my case. I wonder if I use them in my tests if the method I'm testing will appear as covered in the Accessor but not in the original source code.

If this is the case, it is a problem and I need a solution.

有帮助吗?

解决方案

The dev team was interested in this issue and created an MSTest private accessor project in VS 2010.

I ran coverage on it in NCover 3 with MSTest, and it appears that these accessors are reflecting the source code, not a generated version of it, at least in our test.

If you'd like to get the test project and try it out, just contact us at support@ncover.com.

Thanks!

其他提示

If I understand your scenario, then any method called by your test will be shown as covered in the source code.

If the test adds accessors, those will also be shown as covered where they appear, but you can filter them out by excluding the get and set methods that are generated.

Here's a link to the syntax for the method exclude:

http://docs.ncover.com/ref/3-0/ncover-console/command-line/profiling-options#em

We've been successful here with the regex .*.get_.*, just as an example.

NCover Support

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top