Third Question:
+Kent Beck <https://plus.google.com/101480213822270107414> +Martin Fowler
<https://plus.google.com/107610341080687821846> +David Heinemeier Hannson
<https://plus.google.com/102352328760254046201> Can you please discuss the
point made by +Gary Bernhardt
<https://plus.google.com/117747180422979537507> on your following exchange
in part 1 of this hangout:
+Kent Beck <https://plus.google.com/101480213822270107414> : "I just don't
go very far down the mock path. I look at code where you have mock
returning mocks returning mock and my experience is if I have, if I use TDD
I can refactor stuff, and then I heard these stories, people say "well I
use TDD and now I can't refactor anything" and like I could not understand
that, and then I started looking at their tests and well, if you have mocks
returning mocks returning mocks, your test is completely coupled to the
implementation, not the interface, but the exact implementation of some
object, you know, three streets away, of course you can't change anything
without breaking the test. So that for me is too high a price to pay.That
is not a trade off I am willing to make just to get piecemeal development
+Martin Fowler <https://plus.google.com/107610341080687821846>: "And this
is I think much at the heart of this. Confusion about over terminology And
what these different things are. When I read David's initial blog
post...one of the things that came through very clearly was his criticism
of TDD and of how the design damage that comes/flows through it has in
itself tied in a notion of the strong desire for isolation and mocking. And
it is very important to point out that there is nothing within the idea of
how you do either TDD or unit testing that says you have to have that kind
of isolation. Some people are very much in favour of it, others
aren't...Our style of testing, we don't bother with isolation and you know,
it is working very well for us, thank you very much. So that is one thing,
wheter TDD and Unit testing should be tied in with the idea of isolation,
and I look at it as different schools of thought, and I am with Kent, I
hardly ever use mocks, but I know good people who do, so I don't want to
shoot everybody who uses mocks, maybe give it 10 more years and then we'll
drum them out or something, we'll see."
+Gary Bernhardt <https://plus.google.com/117747180422979537507> wrote a
great blog post called "Test Isolation Is About Avoiding Mocks"
https://www.destroyallsoftware.com/blog/2014/test-isolation-is-about-avoiding-mocks
.
+Kent Beck <https://plus.google.com/101480213822270107414> +Martin Fowler
<https://plus.google.com/107610341080687821846> +David Heinemeier Hannson
<https://plus.google.com/102352328760254046201> Can you discuss the point
he makes in the post?
Here are the post's concluding thoughts:
"This post was triggered by Kent's comment about triply-nested mocks. I
doubt that he intended to claim that mocking three levels deep is inherent
to, or even common in, isolated testing. However, many others have proposed
exactly that straw man argument. That argument misrepresents isolated
testing to discredit it; it presents deep mocks, which are to be avoided in
isolated testing, as being fundamental to it; it's fallacious. It's at the
root of the claim that mocking inherently makes tests fragile and
refactoring difficult. That's very true of deep mocks, but not very true of
mock-based isolation done well, and certainly isn't true of isolation done
without mocks.
In a very real sense, isolated testing done test-first exposes design
mistakes before they're made. It translates coupling distributed throughout
the module into mock setup centralized in the test, and it does that before
the coupling is even written down. With practice, that preemptive design
feedback becomes internalized in the programmer, granting some of the
benefit even when not writing tests. There may be other paths to that
skill, but I'm still learning from my tests after seven years of isolating
around 50% of the time. This path also happens to produce a trail of
sub-millisecond tests fully covering every component designed using it,
which is alright with me."
Post by Philip SchwarzHangout https://plus.google.com/events/cco30ri6dpkej4h4d8mejmat98o have
invited spectators to put forward questions for the final part of the
debate.
IMHO It would be a shame if we missed the opportunity to ask them to talk
about "mocks returning mocks returning mocks" and the important points so
Avoiding Mocks"
https://www.destroyallsoftware.com/blog/2014/test-isolation-is-about-avoiding-mocks
.
If the topic matters to you, how about putting forward your questions, so
there is a better chance of the topic being debated?
To propose a question, just click play on the video you see on the hangout
page.
Philip Schwarz
--
You received this message because you are subscribed to the Google Groups "software_craftsmanship" group.
To unsubscribe from this group and stop receiving emails from it, send an email to software_craftsmanship+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To post to this group, send email to software_craftsmanship-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
Visit this group at http://groups.google.com/group/software_craftsmanship.
For more options, visit https://groups.google.com/d/optout.