# Official poll - unit testing

**URL:** <https://www.ruby-forum.com/t/official-poll-unit-testing/164516>\
**Category:** Ruby\
**Created:** [April 2, 2009, 3:42am UTC](https://www.ruby-forum.com/t/official-poll-unit-testing/164516 "2009-04-02T03:42:17Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![john\_maclean](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e8c25b/32.png) [@john\_maclean](https://www.ruby-forum.com/u/john_maclean)\
**Post date:** [April 2, 2009, 3:42am UTC](https://www.ruby-forum.com/t/official-poll-unit-testing/164516/1 "2009-04-02T03:42:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![john\_maclean](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e8c25b/32.png) [@john\_maclean](https://www.ruby-forum.com/u/john_maclean)\
**Post date:** [April 2, 2009, 4:00am UTC](https://www.ruby-forum.com/t/official-poll-unit-testing/164516/2 "2009-04-02T04:00:37Z")

</div>

> - I only unit test when

the wind blows…

---

<div class="post-metadata">

**Author:** ![john\_maclean](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e8c25b/32.png) [@john\_maclean](https://www.ruby-forum.com/u/john_maclean)\
**Post date:** [April 2, 2009, 5:44am UTC](https://www.ruby-forum.com/t/official-poll-unit-testing/164516/3 "2009-04-02T05:44:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![john\_maclean](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e8c25b/32.png) [@john\_maclean](https://www.ruby-forum.com/u/john_maclean)\
**Post date:** [April 2, 2009, 6:11am UTC](https://www.ruby-forum.com/t/official-poll-unit-testing/164516/4 "2009-04-02T06:11:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![john\_maclean](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e8c25b/32.png) [@john\_maclean](https://www.ruby-forum.com/u/john_maclean)\
**Post date:** [April 2, 2009, 10:06am UTC](https://www.ruby-forum.com/t/official-poll-unit-testing/164516/5 "2009-04-02T10:06:17Z")

</div>

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](http://slides.games-with-brains.net)

raise ArgumentError unless @reality.responds\_to? :reason

---

<div class="post-metadata">

**Author:** ![john\_maclean](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e8c25b/32.png) [@john\_maclean](https://www.ruby-forum.com/u/john_maclean)\
**Post date:** [April 2, 2009, 6:43am UTC](https://www.ruby-forum.com/t/official-poll-unit-testing/164516/6 "2009-04-02T06:43:40Z")

</div>

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.

–

```auto
Tom C., MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< removed_email_address@domain.invalid >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)

```

---

<div class="post-metadata">

**Author:** ![john\_maclean](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e8c25b/32.png) [@john\_maclean](https://www.ruby-forum.com/u/john_maclean)\
**Post date:** [April 2, 2009, 12:02pm UTC](https://www.ruby-forum.com/t/official-poll-unit-testing/164516/7 "2009-04-02T12:02:40Z")

</div>

2009/4/2 Julian L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> > > 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

---

<div class="post-metadata">

**Author:** ![john\_maclean](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e8c25b/32.png) [@john\_maclean](https://www.ruby-forum.com/u/john_maclean)\
**Post date:** [April 2, 2009, 10:01am UTC](https://www.ruby-forum.com/t/official-poll-unit-testing/164516/8 "2009-04-02T10:01:00Z")

</div>

Personally, bdd rocks.

Blog: [http://random8.zenunit.com/](http://random8.zenunit.com/)  
Learn rails: [http://sensei.zenunit.com/](http://sensei.zenunit.com/)
