[Tutor] properties beginner M Dawson book

Alan Gauld alan.gauld at btinternet.com
Mon Jun 11 18:24:48 CEST 2012


On 11/06/12 16:05, brian arb wrote:

> Highly recommend writing unittest, each unit test sends a specific input
> to a method and verifies that the method returns the expected value, or
> takes the expected action. Unit tests prove that the code you are
> testing does in fact do what you expect it to do.


While unit testing is absolutely essential we need to remember the 
limitations. They only test that output matches the expected results for 
the inputs that we remember to test. Many of the bugs found in system 
testing are the result of inputs the programmer never thought to unit 
test... So "prove" in the statement above may be a tad optimistic.

One reason that testing should ideally never be done by the person 
writing the code. (And even when it isn't things still get missed!)
But in practice unit testing usually is.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/





More information about the Tutor mailing list