Discussion:
[ESSAY] “Writing tests, motherfucker!”
Shlomi Fish
2013-01-26 09:13:14 UTC
Permalink
Hi all,

I hope the *.perl.org filters won't give troubles to my title and content, but
I've done it as a tribute to http://programming-motherfucker.com/ , which I
recommend going over, being the anti-methodology/NoMethodology (but in part
apparently written tongue-in-cheek), and which isn't too long a read, and also
hosts the useful http://programming-motherfucker.com/become.html list of
resources for learning.

So why am I writing this? I used to feel guilty about not being conscious of
the distinction between the various scopes of tests, like unit tests vs.
integration tests vs. system tests vs. functional tests etc. when I wrote the
tests. I just noticed that I need a test here (as a regression test for a bug,
or to TDD a new feature, or after implementing a new feature, etc.), and wrote
it using Test::More or whatever. However, now I feel that trying to
philosophise about the distinction between all those is not so useful for the
people who are actually trying to write the tests.

“Tests are good, mmkay? Just freaking write them!”

chromatic has expressed some sentiments against the so-called “Behaviour Driven
Development” (BDD) Domain-specific-languages (DSLs) such as cucumber here:

http://modernperlbooks.com/mt/2012/04/what-testing-dsls-get-wrong.html

One thing he says in a comment there is:

<<<<
Our clients are the parents, guardians, and teachers of children between the
ages of eight and twelve inclusive.

The intent of Cucumber is to make readable testcases, just as the intent of
COBOL and AppleScript and visual component programming is to enable
non-programmers to create software without having to learn how to program.
Not only is it impossible to have people who are non-programmers write
structure code without learning how to program (at least until we get
sufficiently intelligent Sci-Fi-like AI that will be able to perform
programming like humans do), I feel that you need to write some kind of code,
however formatted, to write tests, just like HTML and CSS and spreadsheet
programs, involve writing some kind of *code*.

If you want to have your clients write tests, my best suggestion is to other
instruct them in the proper methodology and discipline of coding, or
alternatively have them show you how to reproduce the problem (using
screenshots, screencasts, shared remote desktop sessions, etc.) and then *you*
write a test for it.[Note]

{{{
[Note] - some people fear that teaching laymen how to code will create
competition for professional programmers, and dilute the profession. However,
this is not true, because there's always a difference between a casual dealer
in a craftsmanship or art, and someone who invested a substantial amount of
time doing it. E.g: lots of people can cook well, but not everyone is a
professional Chef.
}}}

So I think the distinction between the various tests may be useful for
methodologists and software engineering researchers (people who try to guide
other people how to code) more than the people who are actually coding. To quote
Picasso: “When art critics get together they talk about Form and Structure and
Meaning. When artists get together they talk about where you can buy cheap
turpentine.” ( taken from http://orip.org/ ). Similarly, literature
critics and researchers have very little to say that is of use for most writers
and even authors. I hated studying Literature (what Americans might call
"English" although naturally in Israel, we study Hebrew texts) with a
passion, and didn't do too well on the tests (in part because I refused to
write a lot of extraneous text, which the teacher seemed to have liked), only
to become a writer of fiction and essays (see
http://www.paulgraham.com/essay.html ) after graduation, which most people I
talked with seem to have liked and appreciate what I wrote (although I admit
they are certainly not letter perfect).

Similarly, I'm now struggling with this tome -
http://www.amazon.com/xUnit-Test-Patterns-Refactoring-Code/dp/0131495054 -
which seems like I cannot see the forest for the trees from it, while I
really enjoyed reading the much shorter and much more hands-on
http://en.wikipedia.org/wiki/Test-Driven_Development_by_Example (by Kent Beck).

The time we talk about how to write tests is often better spent writing tests
(or production code, which is, naturally, what tests are aim to support and
are meaningless without it), so I think we should just “freaking write them”.

“Write tests, m*****f*****!”

Regards,

Shlomi Fish
--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
Escape from GNU Autohell - http://www.shlomifish.org/open-source/anti/autohell/

Linux — Because Software Problems Should not Cost Money.

Please reply to list if it's a mailing list post - http://shlom.in/reply .
Jeffrey Ryan Thalhammer
2013-01-30 00:36:54 UTC
Permalink
Post by Shlomi Fish
However, now I feel that trying to
philosophise about the distinction between all those is not so useful for the
people who are actually trying to write the tests.
+1000

I once had fervent debates with colleagues about whether something was a "unit test" or "integration test" or "acceptance test". I always felt the distinction was pointless, but now I understand why it happened.

Unit tests were regarded as the developer's realm. Integration tests are the build engineer's responsibility. And acceptance tests might belong to QA. So labeling tests serves as a means for allocating work (and blame).

Fortunately, I've seen more and more organizations dismantle their QA teams completely. Quality is everyone's responsibility.

Now, somebody, just write the damn test :)

-Jeff
Shlomi Fish
2013-01-30 04:47:45 UTC
Permalink
Hi Jeffrey,

On Tue, 29 Jan 2013 16:36:54 -0800
Post by Jeffrey Ryan Thalhammer
Post by Shlomi Fish
However, now I feel that trying to
philosophise about the distinction between all those is not so useful for
the people who are actually trying to write the tests.
+1000
:-)
Post by Jeffrey Ryan Thalhammer
I once had fervent debates with colleagues about whether something was a
"unit test" or "integration test" or "acceptance test". I always felt the
distinction was pointless, but now I understand why it happened.
Unit tests were regarded as the developer's realm. Integration tests are the
build engineer's responsibility. And acceptance tests might belong to QA.
So labeling tests serves as a means for allocating work (and blame).
Fortunately, I've seen more and more organizations dismantle their QA teams
completely. Quality is everyone's responsibility.
Well, I feel that having some testers who try to break the software is useful
for programs which have a GUI, a web UI, etc. They don't need to be coders
per-ce, but should be clueful to try various things. I am always frustrated
that various web UIs don't behave exactly like I want, and I feel that
contacting the web-site owner will yield nothing. (Google, I am looking at
you).

As someone who is obsessed with even the smallest usability details on
http://www.shlomifish.org/ and other sites, I feel that the standard “You have
a problem with a site, and I agree with you that it's a problem, but I'm not
going to make it a high priority to fix it, so f**k you!” (as opposed to what
Joel on Software said here -
http://www.joelonsoftware.com/articles/customerservice.html .
Post by Jeffrey Ryan Thalhammer
Now, somebody, just write the damn test :)
Agreed. :-).
Post by Jeffrey Ryan Thalhammer
-Jeff
Regards,

Shlomi Fish
--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
Stop Using MSIE - http://www.shlomifish.org/no-ie/

My Commodore 64 is suffering from slowness and insufficiency of memory, and its
display device is grievously short of pixels. Can anybody help?
— Omer Zak

Please reply to list if it's a mailing list post - http://shlom.in/reply .
f***@numericable.fr
2013-01-30 09:10:57 UTC
Permalink
Hello there,
You should consider the aim of the tests.
Whether it is for UAT (user acceptance) for a new functionality.
Or just Sanity Tests :
=> Non regressions tests
But if it is automated, I totally agree : please just write the damn tests
;-))
Note that they should be normally written/designed before development by
the functional teams ...
Which is rarely the case.
Best regards
Fabien


From: Shlomi Fish <***@shlomifish.org>
To: Jeffrey Ryan Thalhammer <***@imaginative-software.com>,
Cc: perl-***@perl.org
Date: 30/01/2013 07:58
Subject: Re: [ESSAY] “Writing tests, motherfucker!”



Hi Jeffrey,

On Tue, 29 Jan 2013 16:36:54 -0800
Post by Jeffrey Ryan Thalhammer
Post by Shlomi Fish
However, now I feel that trying to
philosophise about the distinction between all those is not so useful for
the people who are actually trying to write the tests.
+1000
:-)
Post by Jeffrey Ryan Thalhammer
I once had fervent debates with colleagues about whether something was a
"unit test" or "integration test" or "acceptance test". I always felt the
distinction was pointless, but now I understand why it happened.
Unit tests were regarded as the developer's realm. Integration tests are the
build engineer's responsibility. And acceptance tests might belong to QA.
So labeling tests serves as a means for allocating work (and blame).
Fortunately, I've seen more and more organizations dismantle their QA teams
completely. Quality is everyone's responsibility.
Well, I feel that having some testers who try to break the software is
useful
for programs which have a GUI, a web UI, etc. They don't need to be coders
per-ce, but should be clueful to try various things. I am always
frustrated
that various web UIs don't behave exactly like I want, and I feel that
contacting the web-site owner will yield nothing. (Google, I am looking at
you).

As someone who is obsessed with even the smallest usability details on
http://www.shlomifish.org/ and other sites, I feel that the standard “You
have
a problem with a site, and I agree with you that it's a problem, but I'm
not
going to make it a high priority to fix it, so f**k you!” (as opposed to
what
Joel on Software said here -
http://www.joelonsoftware.com/articles/customerservice.html .
Post by Jeffrey Ryan Thalhammer
Now, somebody, just write the damn test :)
Agreed. :-).
Post by Jeffrey Ryan Thalhammer
-Jeff
Regards,

Shlomi Fish

--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
Stop Using MSIE - http://www.shlomifish.org/no-ie/

My Commodore 64 is suffering from slowness and insufficiency of memory,
and its
display device is grievously short of pixels. Can anybody help?
— Omer Zak

Please reply to list if it's a mailing list post - http://shlom.in/reply .
Loading...