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

Notification

Icon
Error

feature suggestion: discover/recognise NUnit's TestCase attributes
chillitom
#1 Posted : Sunday, April 1, 2012 6:17:51 PM(UTC)
Rank: Member

Groups: Registered
Joined: 4/1/2012(UTC)
Posts: 19

Thanks: 1 times
Was thanked: 3 time(s) in 3 post(s)
Hi Remco,

NCrunch doesn't currently seem to recognise/obey TestCase attribute when using NUnit. Would be great to be able to run our parameterized tests.

Thanks,

T.
Remco
#2 Posted : Sunday, April 1, 2012 8:50:19 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi Tom -

The behaviour of TestCase attributes is determined very much by the 'Framework utilisation type' you are using for NUnit. This is configurable in your NCrunch solution settings.

If the utilisation type is set to 'StaticAnalysis', NCrunch will take a shortcut approach in its support for TestCases - it will still run the test cases separately, but their results will be bundled under the same test in the UI.

If the utilisation type is set to 'DynamicAnalysis', NCrunch will split the TestCases up according to NUnit logic and the support should be identical to NUnit's GUI runner.

Which of the two types are you using? If you have NCrunch set to static analysis, it may be worth trying the other option to achieve the result you are expecting.


Cheers,

Remco
chillitom
#3 Posted : Monday, April 2, 2012 7:26:50 PM(UTC)
Rank: Member

Groups: Registered
Joined: 4/1/2012(UTC)
Posts: 19

Thanks: 1 times
Was thanked: 3 time(s) in 3 post(s)
Hi Remco,

After some investigation I discovered that NCrunch fails to run TestCases only if they specify the TestName property of the TestCase attribute and it differs from the method name. It's pretty common to set different names if applying more than once TestCase attribute to a parameterized test method.


[TestCase(TestName="Foo2")]
public void Foo()
{
// fails
}

[TestCase(TestName="Bar")]
public void Bar()
{
// Passes
}

Thanks,

T.
Remco
#4 Posted : Monday, April 2, 2012 9:03:20 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Thanks, this helps a lot. I'll take a look :)
mightymuke
#5 Posted : Sunday, May 27, 2012 11:29:13 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/29/2012(UTC)
Posts: 2
Location: New Zealand

Thanks: 2 times
Hi,

This wasn't working for me - I still had the black dots and the test that should have failed appeared to be passing. When I resynchronised it I still had the same result.

Following your suggestion above I changed the utilisation type to 'StaticAnalysis', and the appropriate test started failing. I then changed it back to 'DynamicAnalysis' and the test was still failing (correctly) and all my lights were now green (and red as appropriate).

I now can't recreate this issue, so I was wondering if perhaps the default setting wasn't initially being applied correctly. The version I'm running is 1.39.0.15b.

MM.
Remco
#6 Posted : Sunday, May 27, 2012 11:36:12 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi MM -

If you manage to recreate the issue, can you push through a bug report? I suspect this may be a more subtle issue than the analysis type for the framework.


Cheers,

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