Support for ExpectedException

Jun 17, 2011 at 3:41 PM

Is there support for ExpectedException for ExpectedException in Statlight?


Jun 17, 2011 at 9:12 PM

What testing framework are you using?

MSTest: Yes it's supported.
NUnit: No it's NOT supported.
XUnit: not sure
UnitDriven: I think so - but not sure.

Regardless of what framework you're using, it's generally considered a bad practice to use the ExpectedExceptionAttribute. I'd recommend using other ways to assert an exception was thrown.

Jun 18, 2011 at 12:56 PM

Thanks for the reply.

I'm actually using MSTest. Statlight recognises the ExpectedException attribute and shows a message with yellow color (Failed) in the command prompt. However, the end result indicates that the test has passed.

I have to mention that its been only a week that I'm using Statlight, hence the mentioning of yellow message (:D).

Will try to follow you advice thought.


Jun 18, 2011 at 5:48 PM

FYI: The following post has a good explination for why to avoid using the [ExpectedException] attribute.

Jun 18, 2011 at 7:42 PM

Good article.