RE: [Pyunit-interest] comments on PyUnit
Brought to you by:
purcell
From: Patrick K. O'B. <po...@or...> - 2001-07-03 22:17:19
|
<getting on soapbox> Were you honestly able to maintain a straight face while you wrote this? Why would we write tests that we expected to fail? We expect all the tests to succeed, unless the code is wrong. That is the whole premise behind the unit testing framework. Take a look at these method descriptions taken from http://www.python.org/doc/current/lib/testcase-objects.html and try to think of a good name for each method: Test that first and second are equal. (sounds like testEqual to me) Test that first and second are not equal. (sounds like testNotEqual to me) Test that an exception is raised. (sounds like testException or testRaises to me) I can't think of any word that is less ambiguous in this context. Who cares what action is to be taken? We just want to test certain conditions and raise a red flag if anything breaks. Some of those conditions happen to fit into a common pattern so we have specific methods for those - we want to test for equality, inequality and the raising of exceptions. Then we have a blanket test that allows the user to define their own condition. Finally, we want to test for the inverse of some condition. Frankly, the existing names seem like a horrific attempt to avoid the word "test." Reminds me of the story of the blind men trying to describe an elephant. Now that we can see the beast, let's just call it an elephant. The more I think about this the more convinced I am about my position. Unless someone can show how assert* or fail* do a better job to "indicate clearly whether the thing to be tested is expected to succeed or fail" and "what action is to be taken once the test is completed." <off soapbox> --- Patrick K. O'Brien Orbtech "I am, therefore I think." -----Original Message----- From: pyu...@li... [mailto:pyu...@li...]On Behalf Of Gareth Rees Sent: Tuesday, July 03, 2001 1:52 PM To: po...@or... Cc: Pyunit-Interest Subject: RE: [Pyunit-interest] comments on PyUnit At 10:54 -0500 2001-07-03, Patrick K. O'Brien wrote: >Okay, here is a proposal. And I know I am coming up with this rather late in >the game, for which I apologize. > >The magic word is "test." And the new method names are: "Test" is a poor name in this context, because the name "test" doesn't indicate clearly whether the thing to be tested is expected to succeed or fail, nor what action is to be taken once the test is completed. _______________________________________________ Pyunit-interest mailing list Pyu...@li... http://lists.sourceforge.net/lists/listinfo/pyunit-interest |