¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: "bottom-up" TDD and common behaviors


 

The way I test if animals have updatable fields, I try to update a field and check that it updated.

Alan Baljeu
alanbaljeu@...



On Sunday, December 1, 2019, 07:16:01 p.m. EST, Brian Marick <marick@...> wrote:


What I¡¯m guessing is that you invent an assertion that, when true of the return value, implies that it has been made ¡°with updatable fields¡±. So it¡¯s a property of the data rather than a property of how it was created.

Yeah, that probably makes sense. Forget I asked.

On Dec 1, 2019, at 6:07 PM, Brian Marick <marick@...> wrote:

Here¡¯s some code I have:

<Screen Shot 2019-12-01 at 5.55.54 PM.png>


Here¡¯s a correctness claim about that code: ¡°any function that returns one or more Animals must ensure that those animals have ¡®updatable fields¡¯¡±. I come from a mockish tradition, in which that claim would be stated directly by an assertion that `put_updatable_fields` would be called and be used as the return value.?

I¡¯ve been trying to do non-mockish testing in this app, and I¡¯ve gotten myself all bollixed up. Without mocks, what would tests for these four functions look like?

I think I once knew the answers to such questions, but I can¡¯t remember them.

Join [email protected] to automatically receive all group messages.