Jader Dias
Jader Dias

Reputation: 90475

How does NCover coverage report handle MSTest accessors?

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.

Upvotes: 0

Views: 304

Answers (2)

NCover Support
NCover Support

Reputation: 271

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 [email protected].

Thanks!

Upvotes: 1

NCover Support
NCover Support

Reputation: 271

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

Upvotes: 0

Related Questions