Feature Suggestions

feature suggestion: discover/recognise NUnit's TestCase attributes

Started by chillitom on 9,271 views

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.
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
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.
Thanks, this helps a lot. I'll take a look :)
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.
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

Post a reply

Log in to reply.