[Mono-dev] [Mono-list] Let's not compare exception messages in nunit tests
gert.driesen at telenet.be
Fri Jun 13 07:57:22 EDT 2008
I sometimes write tests that check for part of an exception message.
When the message is "Invalid value XXX for argument Z", I'd check for XXX
Is that also considered a bad practice?
Got a concrete example of a test where we actually assert the exception
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
More information about the Mono-devel-list