[pm-h] Good article from chromatic about testing

G. Wade Johnson gwadej at anomaly.org
Thu Jul 25 11:21:43 PDT 2013


On Thu, 25 Jul 2013 12:57:55 -0500
Charles Boyd <csboyd07 at gmail.com> wrote:

> His earlier article on testing was pretty good too:
> 
> "Grouping everything under functions also has the benefit of reminding
> other developers that it's okay to write more functions. For example,
> if every test for every action in a controller ought to verify access
> permissions, it's easy to write a helper function to set up an
> environment with and without access permissions to test both ways.
> (Some of these test functions get promoted to project-specific test
> libraries.)"
> 
> http://www.modernperlbooks.com/mt/2013/05/organizing-perl-test-files.html

I remember that one. One issue chromatic skips in both of these is the
issue of "too much information hiding" in tests.

Sometimes, having the tests point out how much set up there is before
using a function or object is an important indicator of design
problems. Hiding that in a function can make it hard to recognize your
mistake.

Using jUnit style testing years ago, I saw setUp() methods that ran
dozens to over a hundred lines long. The individual tests looked
clean because the ugliness was hidden in setUp().

Like all important programming decisions, there are always trade-offs.

G. Wade

> On Mon, Jul 22, 2013 at 9:24 AM, G. Wade Johnson <gwadej at anomaly.org>
> wrote:
> 
> > chromatic nails some of the subtly of writing good tests here.
> >
> > http://www.modernperlbooks.com/mt/2013/07/good-tests-hate-ambiguity.html
> >
> > He doesn't provide any advice you can directly use, it's more of a
> > "how do I think about this thing" kind of post.
> >
> > G. Wade
> > --
> > The function of good software is to make the complex appear to be
> > simple. -- Grady Booch
> > _______________________________________________
> > Houston mailing list
> > Houston at pm.org
> > http://mail.pm.org/mailman/listinfo/houston
> > Website: http://houston.pm.org/
> >
> 
> 
> 


-- 
Fortune knocks but once, but misfortune has much more patience.
                                                -- Laurence J. Peter


More information about the Houston mailing list