[Mono-dev] [Mono-list] Let's not compare exception messages in nunit tests

Atsushi Eno atsushi at ximian.com
Fri Jun 13 08:23:59 EDT 2008


Uh, yep I meant such tests.

I'm attaching an example cases in DataTableTest.cs

Atsushi Eno

Gert Driesen wrote:
> Hey Atsushi,
> 
> I sometimes write tests that check for part of an exception message.
> 
> For example:
> 
> When the message is "Invalid value XXX for argument Z", I'd check for 
> XXX and Z.
> 
> Is that also considered a bad practice?
> 
> Got a concrete example of a test where we actually assert the exception 
> message itself?
> 
> Thanks!
> 
> Gert
> 
> --------------------------------------------------
> From: "Atsushi Eno" <atsushi at ximian.com>
> Sent: Friday, June 13, 2008 12:35 PM
> To: <mono-list at lists.ximian.com>; <mono-devel-list at lists.ximian.com>
> Subject: [Mono-list] Let's not compare exception messages in nunit tests
> 
>> Hey guys,
>>
>> I have seen a lot of bad NUnit tests that unnecessarily compare
>> exception messages. They are wrong not only because they fail
>> in non-English Windows environment but also because those tests
>> will fail when Microsoft improves the messages. Furthermore, it
>> blocks possible message translation in the future.
>> They have been blocking me from checking NUnit test sanity. And
>> thanks to that, now we actually have a lot of wrong compatibility
>> assumptions in our own tests. (I don't say incompatibility is bad
>> but they do not have to be asserted unnecessarily.)
>>
>> Let me repeat: let's not compare any localizable strings.
>>
>> Atsushi Eno
>> _______________________________________________
>> Mono-list maillist  -  Mono-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-list
>>
> 
> 

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: eliminate-english-dependent-check.patch
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080613/8904596b/attachment-0001.pl 


More information about the Mono-devel-list mailing list