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

Notification

Icon
Error

TestCaseSource attribute incorrectly requires TestCase attribute, not Test?
alexnorcliffe
#1 Posted : Friday, September 23, 2011 1:53:17 PM(UTC)
Rank: Member

Groups: Registered
Joined: 9/2/2011(UTC)
Posts: 23

Thanks: 1 times
Was thanked: 5 time(s) in 5 post(s)
Sticking this on the forums in addition to the "submit bug report" in case others are getting this, or I'm doing it wrong :)

I've noticed that to use TestCaseSource NUnit attributes with NCrunch, you have to also decorate the test with the TestCase attribute. The NUnit docs (http://www.nunit.org/index.php?p=testCaseSource&r=2.5) say actually you should combine with the Test attribute, not TestCase. Combining with TestCase causes other runners to think that there's a separate test for which I've not provided enough arguments.

Using [Test] appears to be preferred by the R#6 test runner too, and NUnit's runner correctly shows no blank tests if you use the Test attribute, but NCrunch is now something I can't do without ;)
Remco
#2 Posted : Friday, September 23, 2011 2:56:46 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 930 times
Was thanked: 1257 time(s) in 1170 post(s)
I'm amazed that it's possible to get TestCaseSource working at all, as so far I've made no effort to support it :)

Thanks for reporting this one. I'll have a look at it.
1 user thanked Remco for this useful post.
alexnorcliffe on 9/23/2011(UTC)
alexnorcliffe
#3 Posted : Friday, September 23, 2011 3:36:48 PM(UTC)
Rank: Member

Groups: Registered
Joined: 9/2/2011(UTC)
Posts: 23

Thanks: 1 times
Was thanked: 5 time(s) in 5 post(s)
Does the same apply to Value and Range parameter attributes?
Marking a test with TestCase actually runs each range, but with Test it doesn't even identify that it's a valid test (black dots)
Likewise, this is actually invalid as it should be a Test attribute (to make it work in R#6 and NUnit runners)
Maybe TestCase unwittingly uses NUnit's real logic for spotting a test? :)
Remco
#4 Posted : Friday, September 23, 2011 4:13:51 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 930 times
Was thanked: 1257 time(s) in 1170 post(s)
I think what's happening is that NCrunch only considers a test to be a test if it has either a [Test] attribute or a [TestCase] attribute with parameters on the method signature.

So if a test is marked with TestCaseSource and has parameters, then NCrunch thinks it can't be a [Test].

I don't think this one will be a big deal to fix. I'm planning a big blitz on NUnit 2.5 features soon, as many people are asking for them - this includes Value and Range parameter attributes :)
Remco
#5 Posted : Tuesday, October 18, 2011 6:34:08 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 930 times
Was thanked: 1257 time(s) in 1170 post(s)
This issue should be fixed in the 1.35b build that was released this morning.
jeremygray
#6 Posted : Friday, October 21, 2011 4:10:27 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/20/2011(UTC)
Posts: 32
Location: Vancouver, BC, Canada

Thanks: 1 times
Was thanked: 3 time(s) in 3 post(s)
I can confirm that TestCaseSource is working nicely for one of the new tests I wrote to take advantage of it. There's nothing quite like generating 8000+ test cases dynamically. :)
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.045 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download