Re: [testdrivendevelopment] "bottom-up" TDD and common behaviors
"Steve Gordon" <[email protected]> Mon, 2 Dec 2019 12:48:24 -0700
| Newsgroups | gmane.comp.programming.test-driven-development |
|---|---|
| Message-ID | <CAF7qo6Wq7ymORcvwJT5_-tUAuW4FUO=Cmf_QAoc-TJadtJcZpg@mail.gmail.com> |
--0000000000007abf610598bddd48 Content-Type: text/plain; charset="UTF-8" What motivates implementing a setter method under TDD unless there is a test that requires it to exist and work? Extra tests would only be required if we also need to implement is<X>Modifiable() for some field X. On Mon, Dec 2, 2019 at 12:26 PM Ron Jeffries <[email protected]> wrote: > If we're gonna be like that, wouldn't you need a test for every modifiable > field? :) > > On Dec 2, 2019, at 11:16 AM, Steve Gordon <[email protected]> wrote: > > Just because an object has a method implemented to "know" whether or not a > field is modifiable does not mean that that method is correctly > implemented. If there is such a method, you would still have to have at > least two tests that verifies returns true only when that field is actually > modifiable and false only when it is not. > > Unless the application itself needs such a method, I would have a test > that gets the fields value, sets it to a different value, and gets the > field value to verify it changes. > > > > Ron Jeffries > ronjeffries.com > Master your instrument, master the music, then forget all that shit and > just play. -- Charlie Parker > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#35797): https://groups.io/g/testdrivendevelopment/message/35797 Mute This Topic: https://groups.io/mt/64491946/3268755 Group Owner: [email protected] Unsubscribe: https://groups.io/g/testdrivendevelopment/leave/6156322/744556386/xyzzy [[email protected]] -=-=-=-=-=-=-=-=-=-=-=- --0000000000007abf610598bddd48 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">What motivates implementing a setter method under TDD unle= ss there is a test that requires it to exist and work?=C2=A0 Extra tests wo= uld only be required if we also need to implement is<X>Modifiable() f= or some field X.</div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class= = =3D"gmail_attr">On Mon, Dec 2, 2019 at 12:26 PM Ron Jeffries <<a href= =3D"mailto:[email protected]">[email protected]</a>> wrot= e:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0= .8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style=3D= "overflow-wrap: break-word;">If we're gonna be like that, wouldn't = you need a test for every modifiable field? :)<br><div><br><blockquote type= = =3D"cite"><div>On Dec 2, 2019, at 11:16 AM, Steve Gordon <<a href=3D"ma= ilto:[email protected]" target=3D"_blank">[email protected]</a>> w= rote:</div><br><div><span style=3D"font-family:ArialMT;font-size:18px;font-= style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:nor= mal;text-align:start;text-indent:0px;text-transform:none;white-space:normal= ;word-spacing:0px;text-decoration:none;float:none;display:inline">Just beca= use an object has a method implemented to "know" whether or not a= field is modifiable=C2=A0does not mean that that method is correctly imple= mented.=C2=A0 If there is such a method, you would still have to have at le= ast two tests that verifies returns true only when that field is actually m= odifiable and false only when it is not.=C2=A0=C2=A0</span><div style=3D"fo= nt-family:ArialMT;font-size:18px;font-style:normal;font-variant-caps:normal= ;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;= text-transform:none;white-space:normal;word-spacing:0px;text-decoration:non= e"><br></div><div style=3D"font-family:ArialMT;font-size:18px;font-style:no= rmal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text= -align:start;text-indent:0px;text-transform:none;white-space:normal;word-sp= acing:0px;text-decoration:none">Unless the application itself needs such a = method, I would have a test that gets the fields value, sets it to a differ= ent value, and gets the field value to verify it changes.</div></div></bloc= kquote></div><br><div> <div style=3D"color:rgb(0,0,0);font-family:Helvetica;font-style:normal;fon= t-variant:normal;font-weight:normal;letter-spacing:normal;line-height:norma= l;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:n= ormal;word-spacing:0px"><div><div><br>Ron Jeffries</div><div><a href=3D"htt= p://ronjeffries.com" target=3D"_blank">ronjeffries.com</a><br>Master your i= nstrument, master the music, then forget all that shit and just play. -- Ch= arlie Parker</div></div></div> </div> <br></div> <p></p><p></p></blockquote></div> <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/35797">View/Reply Online (#35797)</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=3DP= rivate:%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> --0000000000007abf610598bddd48--