Official poll - unit testing

Hello,
My name is Mr Official and I am hereby asking you to participating in
my poll. “Do you really do unit testing?”

Acceptable answers;

  • Janet Jackme does my dishes cos I unit test all of the time
  • I only unit test when < insert reason for testing>


John M.
07739 171 531
MSc (DIC)

Timezone: GMT

  • I only unit test when

the wind blows…

On Wednesday 01 April 2009 20:40:37 john maclean wrote:

Hello,
My name is Mr Official and I am hereby asking you to participating in
my poll. “Do you really do unit testing?”
[…]

  • I only unit test when

I only unit test when I have enough of a concept of what I’m trying to
build
that a test makes sense.

Places where I don’t test:

  • Vague prototypes. Tests are a way to describe how something should
    behave.
    If I don’t yet know how it’s supposed to behave, I can’t really write a
    test.
    Sometimes, you just have to experiment.

  • Tiny one-off scripts. Often, writing a test for these would require
    duplicating most of what the script already does, and it’s not likely to
    contain any subtle bugs that you wouldn’t find by just running it.

  • UIs. Mostly because I haven’t gotten around to learning Selenium or
    anything similar. Also because this is the hardest place to automate
    testing,
    and the easiest place to manually test.

john maclean wrote:

In truth, I only unit test after something breaks. I guess I start
doing things thinking “this will only be a one or two line change” and
before I know it, I’ve added an extra module of code that is largely
based on old code, but just different enough to break it. I also find
that working in Ruby is counter-productive to working up the mental
drive to unit test. This is not me getting all fanatic about ruby (ok,
much) but it’s true of other dynamic languages. I grew up on Java and C
and with that, one tends to get bogged down in so much detail trying to
translate behaviour into code, that testing is a nice, high-level view
of your program that validates your design to some degree. In dynamic
languages, things are already pretty high-level and the tendency here is
to believe that writing code correctly every time is about as difficult
as writing english sentences with correct grammar each time. A quick
run through the spell checker (ruby -wc) and everything’s done, right?

So yes, it’s probably the confidence I get from a dynamic language
after C and the like that lets me believe that I’ve become a brilliant
coder overnight because I can suddenly parse strings quickly without
worrying about memory leaks, pointers and NUL chars (when I was at
university we had a 10% test dedicated to doing just that!). In short,
the bug minefields I trained to be extra-worried about no longer exist,
so setting up a Unit Test for the ‘easy bits’ mentally seems like more
effort than it’s worth. Until it breaks. Part of solving the problem
is obviously defining the solution, to me, which is exactly where the
test comes!

It might be a slightly contradictory way of looking at things, but it’s
certainly honest!

Michael

=======================================================================
This email, including any attachments, is only for the intended
addressee. It is subject to copyright, is confidential and may be
the subject of legal or other privilege, none of which is waived or
lost by reason of this transmission.
If the receiver is not the intended addressee, please accept our
apologies, notify us by return, delete all copies and perform no
other act on the email.
Unfortunately, we cannot warrant that the email has not been
altered or corrupted during transmission.

On 2 Apr 2009, at 02:40, john maclean wrote:

Hello,
My name is Mr Official and I am hereby asking you to participating in
my poll. “Do you really do unit testing?”

Acceptable answers;

  • Janet Jackme does my dishes cos I unit test all of the time
  • I only unit test when < insert reason for testing>

I only unit test for satirical effect.

Ellie

Eleanor McHugh
Games With Brains
http://slides.games-with-brains.net

raise ArgumentError unless @reality.responds_to? :reason

john maclean wrote:

And from whatever data you get what do you expect to infer?

This is waste of time. At most, you’ll get a frequency distribution of
those who responds.

Meaning…what?

You cannot know.

t.

Tom C., MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< [email protected] >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)

2009/4/2 Julian L. [email protected]:

My name is Mr Official and I am hereby asking you to participating in
Places where I don’t test:

  • UIs. Mostly because I haven’t gotten around to learning Selenium or
    anything similar. Also because this is the hardest place to automate
    testing,
    and the easiest place to manually test.

Julian,

Looks like you’ve just started your blog but when I search for bdd I
get a “undefined local variable or method `on_empty’ for #”. That
supposed to happen?


John M.
07739 171 531
MSc (DIC)

Timezone: GMT

Personally, bdd rocks.

Blog: http://random8.zenunit.com/
Learn rails: http://sensei.zenunit.com/