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

Notification

Icon
Error

TestCase with too many parameters does not fail
jjvdgeer
#1 Posted : Friday, October 13, 2017 1:00:30 PM(UTC)
Rank: Member

Groups: Registered
Joined: 10/2/2017(UTC)
Posts: 16
Location: Norway

Was thanked: 1 time(s) in 1 post(s)
Shouldn't NCrunch report this in some way as an error? :

[TestCase(42, "wrong")]
public void TestIt(int i)
{
}

The NUnit testcase has a parameter mismatch. It never executes the test, which has bitten me twice the last week...

This does fail though:

[TestCase("wrong")]
public void TestIt(int i)
{
}
Remco
#2 Posted : Friday, October 13, 2017 11:06:31 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Hi, can you confirm which version of NUnit and NCrunch you're using here?

I see the message: Too many arguments provided, provide at most 1 arguments.
jjvdgeer
#3 Posted : Monday, October 16, 2017 6:27:31 AM(UTC)
Rank: Member

Groups: Registered
Joined: 10/2/2017(UTC)
Posts: 16
Location: Norway

Was thanked: 1 time(s) in 1 post(s)
NCrunch is the newest (as far as I'm aware), 3.11.0.9. NUnit is actually pretty old, it's 2.6.3. Maybe I should update NUnit?
Remco
#4 Posted : Monday, October 16, 2017 6:51:05 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
This is an error that's being kicked up at discovery time. At this point in the process, error capture and handling is much less sophisticated under NUnit v2. NCrunch recognises that there is a problem with the test, but the error itself isn't reported. The issue here is that NUnit v2 does not have a formal API for test runners, so when things go wrong there is no consistent way to respond to issues.

Fixing this problem isn't really feasible, since NUnit v2 is itself several years out of date now and the nature of its design means that fixing edge cases like this just isn't worth the risk. NUnit v3 has an entirely new adapter with a formal API and error handling that is much better suited to this kind of thing. If this problem is causing you pain, I recommend upgrading to NUnit v3.
jjvdgeer
#5 Posted : Monday, October 16, 2017 8:59:32 AM(UTC)
Rank: Member

Groups: Registered
Joined: 10/2/2017(UTC)
Posts: 16
Location: Norway

Was thanked: 1 time(s) in 1 post(s)
OK. It has been annoying but it will probably take a while before it is annoying again (i.e. before someone manages to put in a test with the wrong number of parameters). :) I don't think there's any good reason why we shouldn't be able to update to NUnit 3, so I'll look into that.

Thanks.
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.032 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download