Re: [testdrivendevelopment] "bottom-up" TDD and common behaviors
"Brian Marick" <[email protected]> Sun, 1 Dec 2019 18:15:04 -0600
| Newsgroups | gmane.comp.programming.test-driven-development |
|---|---|
| Message-ID | <[email protected]> |
--Apple-Mail=_B0ADC81C-769A-406D-9F1B-9F8EC7EE384E Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 What I=E2=80=99m guessing is that you invent an assertion that, when true o= f the return value, implies that it has been made =E2=80=9Cwith updatable f= ields=E2=80=9D. So it=E2=80=99s a property of the data rather than a proper= ty of how it was created. Yeah, that probably makes sense. Forget I asked. > On Dec 1, 2019, at 6:07 PM, Brian Marick <[email protected]> wrote: >=20 > Here=E2=80=99s some code I have: >=20 > <Screen Shot 2019-12-01 at 5.55.54 PM.png> >=20 >=20 > Here=E2=80=99s a correctness claim about that code: =E2=80=9Cany functio= n that returns one or more Animals must ensure that those animals have =E2= =80=98updatable fields=E2=80=99=E2=80=9D. I come from a mockish tradition,= in which that claim would be stated directly by an assertion that `put_upd= atable_fields` would be called and be used as the return value.=20 >=20 > I=E2=80=99ve been trying to do non-mockish testing in this app, and I=E2= = =80=99ve gotten myself all bollixed up. Without mocks, what would tests fo= r these four functions look like? >=20 > I think I once knew the answers to such questions, but I can=E2=80=99t r= emember them. >=20 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#35790): https://groups.io/g/testdrivendevelopment/mess= age/35790 Mute This Topic: https://groups.io/mt/64491946/3268755 Group Owner: [email protected] Unsubscribe: https://groups.io/g/testdrivendevelopment/leave/6156322/74455= 6386/xyzzy [[email protected]] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- --Apple-Mail=_B0ADC81C-769A-406D-9F1B-9F8EC7EE384E Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 <html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; charset= = =3Dutf-8"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: = space; line-break: after-white-space;" class=3D"">What I=E2=80=99m guessing= is that you invent an assertion that, when true of the return value, impli= es that it has been made =E2=80=9Cwith updatable fields=E2=80=9D. So it=E2= =80=99s a property of the data rather than a property of how it was create= d.<div class=3D""><br class=3D""></div><div class=3D"">Yeah, that probably = makes sense. Forget I asked.<br class=3D""><div><br class=3D""><blockquote = type=3D"cite" class=3D""><div class=3D"">On Dec 1, 2019, at 6:07 PM, Brian = Marick <<a href=3D"mailto:[email protected]" class=3D"">marick@example= r.com</a>> wrote:</div><br class=3D"Apple-interchange-newline"><div clas= s=3D""><div style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; -webk= it-line-break: after-white-space;" class=3D"">Here=E2=80=99s some code I ha= ve:<div class=3D""><br class=3D""></div><div class=3D""><span id=3D"cid:E04= 6400A-A2BB-4A13-8014-3FC69D7B77ED"><Screen Shot 2019-12-01 at 5.55.54 PM= .png></span></div><div class=3D""><br class=3D""></div><div class=3D""><= br class=3D""></div><div class=3D"">Here=E2=80=99s a correctness claim abou= t that code: =E2=80=9Cany function that returns one or more Animals must en= sure that those animals have =E2=80=98updatable fields=E2=80=99=E2=80=9D. I= come from a mockish tradition, in which that claim would be stated directl= y by an assertion that `put_updatable_fields` would be called and be used a= s the return value. </div><div class=3D""><br class=3D""></div><div cl= ass=3D"">I=E2=80=99ve been trying to do non-mockish testing in this app, an= d I=E2=80=99ve gotten myself all bollixed up. Without mocks, what would tes= ts for these four functions look like?</div><div class=3D""><br class=3D"">= </div><div class=3D"">I think I once knew the answers to such questions, bu= t I can=E2=80=99t remember them.</div></div> </div></blockquote></div><br class=3D""></div></body></html> <div width=3D"1" style=3D"color:white;clear:both">_._,_._,_</div> <hr> Groups.io Links:<p> You receive all messages sent to this group. <p> <a target=3D"_blank" href=3D"https://groups.io/g/testdrivendevelopment/mes= sage/35790">View/Reply Online (#35790)</a> | <a target=3D"_blank" href=3D"mailto:[email protected]?subj= ect=3DRe:%20Re%3A%20%5Btestdrivendevelopment%5D%20%22bottom-up%22%20TDD%20a= nd%20common%20behaviors">Reply To Group</a> | <a target=3D"_blank" href=3D"mailto:[email protected]?subject=3DPr= ivate:%20Re:%20Re%3A%20%5Btestdrivendevelopment%5D%20%22bottom-up%22%20TDD%= 20and%20common%20behaviors">Reply To Sender</a> | <a target=3D"_blank" href=3D"https://groups.io/mt/64491946/3268755">Mu= te This Topic</a> | <a href=3D"https://groups.io/g/testdrivendevelopment/post">New Topic</a>= <br> <br> <a href=3D"https://groups.io/g/testdrivendevelopment/editsub/3268755">Your= Subscription</a> | <a href=3D"mailto:[email protected]">Contact Group Own= er</a> | <a href=3D"https://groups.io/g/testdrivendevelopment/leave/6156322/7445563= 86/xyzzy">Unsubscribe</a> [[email protected]]<br> <div width=3D"1" style=3D"color:white;clear:both">_._,_._,_</div> --Apple-Mail=_B0ADC81C-769A-406D-9F1B-9F8EC7EE384E--