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

Notification

Icon
Error

No feedback when exception thrown in TestCaseSource attribute method
jasonauk
#1 Posted : Tuesday, March 18, 2014 4:07:45 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 6/28/2013(UTC)
Posts: 2
Location: United Kingdom

Was thanked: 1 time(s) in 1 post(s)
Hello,

When yielding test cases from a method referenced by the TestCaseSource attribute, if the method throws an exception no feedback is given saying that all the tests fail. The test is simply not recognised as a test to run (no coverage)

Is this expected behaviour?

Thanks,
Jason
Remco
#2 Posted : Tuesday, March 18, 2014 9:59:41 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 Jason -

Yes, this is expected behaviour. Quite possibly you'll see the project fail with an error in its analysis task (depending upon the execution time of the 'yield' and NUnit's behaviour). Although this might not seem very intuitive, it works this way for a good reason.

With NUnit, after every time NCrunch builds your test project, it will create a sandbox process in which it loads the output assembly and interrogates NUnit for a list of tests that exist within the assembly.

This analysis step must happen before NCrunch can queue up any tests within the project. As it is required to actually discover the tests, there is no way NCrunch can make sense of any test information before the analysis step has been successfully completed.

TestCaseSource is quite a unique NUnit feature in the sense that it actually allows you to extend NUnit's test discovery system to introduce your own mechanism for producing tests. This means that you are executing your own code during NCrunch's analysis/discovery step, which should be done with extreme care, as there is none of the context available in this setting to help with troubleshooting issues (i.e. code coverage, trace output, etc). NCrunch has no idea of any 'test' that is being executed. This execution is completely under the control of NUnit.
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.026 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download