Build/Test Issues

Xunit Theory and Code Coverage Markers

Started by pglaspey on 7,700 views

I have issues when using Theory tests with xunit where code that gets hit by test does not always get marked as covered. It is intermittent. If I break out the tests into facts then it always shows as covered.

Any ideas?
Hi, thanks for posting!

I'm wondering if this may be to related to the execution pattern taken by the tests while NCrunch is recording coverage. There's a good description in the documentation of how NCrunch's code coverage analysis method can sometimes show unexpected results depending upon the situation. This may be worth having a read to see if it clarifies anything. If you're able to post any code here, or perhaps a screenshot, I'll be happy to delve into the detail with you and we'll see if we can figure it out.


Cheers,

Remco
Remco wrote:Hi, thanks for posting!

I'm wondering if this may be to related to the execution pattern taken by the tests while NCrunch is recording coverage. There's a good description in the documentation of how NCrunch's code coverage analysis method can sometimes show unexpected results depending upon the situation. This may be worth having a read to see if it clarifies anything. If you're able to post any code here, or perhaps a screenshot, I'll be happy to delve into the detail with you and we'll see if we can figure it out.


Cheers,

Remco



I am guessing this situation falls under Dynamic Test Cases
For an Xunit theory, this is quite possible. Also have a read of the difference between Logical and Physical code coverage, as depending upon the nature of your code, this may also have an impact on your code coverage.
Remco wrote:For an Xunit theory, this is quite possible. Also have a read of the difference between Logical and Physical code coverage, as depending upon the nature of your code, this may also have an impact on your code coverage.



Well I worked around it. I had to break out some of the tests from Theory to Fact to get coverage showing 100%.

Would rather not have to do that but I was able to do it and add some additional coverage, so it worked out well.

Post a reply

Log in to reply.