Re: [TDD] Single assert / Single mock rule in practice
P.S. in the first sentence of that second paragraph I should have said you
stub the method and assert something about the SUT, only. In other words:
For a query:
Arrange: stub the query and pass the
By
Adam Sroka
·
#35460
·
|
Re: [TDD] Single assert / Single mock rule in practice
Are you familiar with Command Query Separation (CQS)? I've always found
that the most coherent and useful way to explain why you would choose a
mock or a stub. The most interesting thing about a
By
Adam Sroka
·
#35459
·
|
Re: [TDD] Re: Single assert / Single mock rule in practice
On Wed, Jan 15, 2014 at 12:56 PM, Mateusz ?oskot <mateusz@...> wrote:
>
>
> On 15 January 2014 04:41, Adam Sroka <adam.sroka@...> wrote:
>
>> On Tue, Jan 14, 2014 at 5:31 PM, Mateusz
By
Adam Sroka
·
#35458
·
|
Re: [TDD] Re: Single assert / Single mock rule in practice
Yes, that is waht a general theory of (unit) testing says, but...devil's in
the detail like
classicists vs mockists (
http://martinfowler.com/articles/mocksArentStubs.html)
I mean, lots of things
By
Mateusz ?oskot <mateusz@...>
·
#35457
·
|
Re: [TDD] Re: Single assert / Single mock rule in practice
Sometimes I have test-driven a class, and then I can refactor the "private parts" of the class until it is almost entirely different than the original code, but the tests haven't changed. There may be
By
Keith Ray <keith.ray@...>
·
#35456
·
|
Re: [TDD] Re: Single assert / Single mock rule in practice
Right, that has been clear to me, in theory.
Charlie, you've nailed exactly what I've misunderstood.
Thank you very much.
Best regards,
--
Mateusz ?oskot, http://mateusz.loskot.net
By
Mateusz ?oskot <mateusz@...>
·
#35455
·
|
Re: [TDD] Re: Single assert / Single mock rule in practice
Yes, by definition, because you are testing the way the "unit" works. It is
necessarily coupled to the interface of the object you are testing, though
not necessarily to its internals. If the test is
By
Adam Sroka
·
#35454
·
|
Re: [TDD] Re: Single assert / Single mock rule in practice
Unit tests _are_ about implementation at a certain level, and about
interface at another.
The difference is that we are talking about the "interface" of a class,
which may be buried deep in the
By
Charlie Poole
·
#35453
·
|
Re: [TDD] Re: Single assert / Single mock rule in practice
Yes, I've come up to this conclusion after some time.
Indeed, and that is a matter of my concern.
I'm testing the implementation and somewhat implicitly I'm assuming this
particular test
verifies
By
Mateusz ?oskot <mateusz@...>
·
#35452
·
|
Re: [TDD] Re: Single assert / Single mock rule in practice
"I could have replaced
self.assertTrue(item_exists)
with
foo.xdep.get_item.assert_called_once_with(1)"
These two things are not equivalent tests. your first assert, is correct
and is testing the
By
Avi Kessner
·
#35451
·
|
Re: Single assert / Single mock rule in practice
I'm re-reading my own post and realising, aren't 2) and 3)
breaking the guideline [1] about writing tests to the interface,
not the implementation?
I think the original version of
By
Mateusz ?oskot <mateusz@...>
·
#35449
·
|
Single assert / Single mock rule in practice
Hi,
I'd like to ask for ideas of best practices in case of developing and testing
a wrapper for a Python legacy module.
Especially, about applying the single assert / single mock rule
which I have
By
Mateusz ?oskot <mateusz@...>
·
#35450
·
|
Re: [TDD] Re: A worked example of TDD in D, with some personal ruminations on my own style, and notes on the D language..
Wow, I had missed that blog post. Fascinating. Thanks!
R
Ron Jeffries
www.XProgramming.comPerfectionism is the voice of the oppressor -- Anne Lamott
By
Ron Jeffries
·
#35448
·
|
Re: [TDD] Re: A worked example of TDD in D, with some personal ruminations on my own style, and notes on the D language..
Missed the original post ... so many thanks for sharing!
Wish this group were more active.
By
Luther Baker
·
#35447
·
|
Re: A worked example of TDD in D, with some personal ruminations on my own style, and notes on the D language..
Pity I didn't see this blog post first....
http://blog.8thlight.com/uncle-bob/2013/05/27/TheTransformationPriorityPremise.html
Because then I would have defined "Provocative Test that adds one
By
John Carter
·
#35446
·
|
Re: [TDD] A worked example of TDD in D, with some personal ruminations on my own style, and notes on the D language..
#likedthispost
By
Osias Jota <osiasjota@...>
·
#35445
·
|
A worked example of TDD in D, with some personal ruminations on my own style, and notes on the D language..
So I have being doing TDD for years now.
But I started noting I tend not to do it exactly "By The Book".
So as an exercise I tried going back to doing it...
* Very fine grained steps.
* Small
By
John Carter
·
#35444
·
|
I'm looking for a new challenge
Hi All. I hope this isn't spamming the list, but I could not think of a
better suited place to post.
I'm looking for a job and I would love to hear from you if you live in a
place warmer than Norway
By
Roy Osherove
·
#35443
·
|
Agile & Web programming SURVEY 2013
Dear IT manager/project manager/developer,
We are two software engineering research groups working on improving methodologies and practices for Web development.
We kindly ask you to
By
Erika C. Daniele G.
·
#35442
·
|
Re: [TDD] Test Driving WPF
Please trim down posts. A long thread does not require emails of increasing length. Try to quote only the material you need, and trim the rest.
Thanks,
Ron Jeffries
www.XProgramming.com
Don't ignore
By
Ron Jeffries
·
#35441
·
|