Re: [testdrivendevelopment] "bottom-up" TDD and common behaviors
"Steve Gordon" <[email protected]> Mon, 2 Dec 2019 09:16:27 -0700
| Newsgroups | gmane.comp.programming.test-driven-development |
|---|---|
| Message-ID | <CAF7qo6WS2XSrkFEG1NxGQS46vbuS3ctd_z8mpEQOGKQjgMD--w@mail.gmail.com> |
--000000000000ad242f0598bae785 Content-Type: text/plain; charset="UTF-8" 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. On Mon, Dec 2, 2019 at 6:30 AM Ron Jeffries <[email protected]> wrote: > Yes. And if I didn't mind modifying a field, testing it that way is OK. > If I knew the context I'd have a better idea but as it stands I'm thinking > my object must know whether it can modify fields or not. I suppose a > modifyField operation might return T/F ... > > R > > On Dec 2, 2019, at 8:18 AM, Avi Kessner <[email protected]> wrote: > > Best to test to behaviour, not implementation/capability, I think. > > > > Ron Jeffries > ronjeffries.com > If it is more than you need, it is waste. -- Andy Seidl > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#35795): https://groups.io/g/testdrivendevelopment/message/35795 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]] -=-=-=-=-=-=-=-=-=-=-=- --000000000000ad242f0598bae785 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">Just because an object has a method implemented to "k= now" whether or not a field is modifiable=C2=A0does not mean that that= method is correctly implemented.=C2=A0 If there is such a method, you woul= d still have to have at least two tests that verifies returns true only whe= n that field is actually modifiable and false only when it is not.=C2=A0=C2= = =A0<div><br></div><div>Unless the application itself needs such a method, = I would have a test that gets the fields value, sets it to a different valu= e, and gets the field value to verify it changes.</div></div><br><div class= = =3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Mon, Dec 2, 2019= at 6:30 AM Ron Jeffries <<a href=3D"mailto:[email protected]">ro= [email protected]</a>> wrote:<br></div><blockquote class=3D"gmail_q= uote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,2= 04);padding-left:1ex"><div style=3D"overflow-wrap: break-word;">Yes. And if= I didn't mind modifying a field, testing it that way is OK.<div>If I k= new the context I'd have a better idea but as it stands I'm thinkin= g my object must know whether it can modify fields or not. I suppose a modi= fyField operation might return T/F ...</div><div><br></div><div>R<br><div><= br><blockquote type=3D"cite"><div>On Dec 2, 2019, at 8:18 AM, Avi Kessner &= lt;<a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]= om</a>> wrote:</div><br><div><span style=3D"font-family:ArialMT;font-siz= e: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:none;float:none;display:inlin= e">Best to test to behaviour, not implementation/capability, I think.</span= ></div></blockquote></div><br><div> <div style=3D"color:rgb(0,0,0);letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div s= tyle=3D"color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent= :0px;text-transform:none;white-space:normal;word-spacing:0px"><span style= =3D"border-collapse:separate;color:rgb(0,0,0);font-variant:normal;letter-s= pacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;te= xt-transform:none;white-space:normal;word-spacing:0px;border-spacing:0px"><= div style=3D"overflow-wrap: break-word;"><span style=3D"border-collapse:sep= arate;color:rgb(0,0,0);font-variant:normal;letter-spacing:normal;line-heigh= t:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-= space:normal;word-spacing:0px;border-spacing:0px"><div><br>Ron Jeffries</di= v><div><a href=3D"http://ronjeffries.com" target=3D"_blank">ronjeffries.com= </a></div><div><div>If it is more than you need, it is waste. -- Andy Seidl= </div></div></span></div></span></div></div> </div> <br></div></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/35795">View/Reply Online (#35795)</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> --000000000000ad242f0598bae785--