Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Code Coverage is only collected for the last test case run with [TestCaseSource]
yworksjr
#1 Posted : Wednesday, May 6, 2015 12:33:12 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 1/12/2015(UTC)
Posts: 6
Location: Germany

Was thanked: 1 time(s) in 1 post(s)
Using NCrunch 2.14.0.8 with NUnit. I am using the [TestCaseSource] attribute for test cases of a particular test. Coverage data for that test is collected, but only for the very last test case returned from the source method.

For some reason I cannot reproduce this with a tiny test program, though. Sorry for now (I can't share my whole code here), I will investigate further.
yworksjr
#2 Posted : Wednesday, May 6, 2015 1:30:28 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 1/12/2015(UTC)
Posts: 6
Location: Germany

Was thanked: 1 time(s) in 1 post(s)
Ok, solved it. This had to do with my test method taking an object as argument that didn't have a ToString(). Also every test had a description, but not a name.

Thus every test had the same name as far as NUnit was concerned, which probably led to this problem. ReSharper could still run them individually, though. NCrunch however, only sees one test case, despite there being a dozen.
Remco
#3 Posted : Wednesday, May 6, 2015 9:48:12 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,984

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
yworksjr;7283 wrote:
Ok, solved it. This had to do with my test method taking an object as argument that didn't have a ToString(). Also every test had a description, but not a name.

Thus every test had the same name as far as NUnit was concerned, which probably led to this problem. ReSharper could still run them individually, though. NCrunch however, only sees one test case, despite there being a dozen.


Yes - this is a known limitation in NCrunch as far as NUnit is concerned. NCrunch needs to generate names for the tests discovered by NUnit, and the only way it can do this is using the test's name. This means that tests must have a unique name when they are discovered from TestCaseSource.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.025 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download