[LRUG] TDD when removing functionality

Steven Deobald steven at c42.in
Wed Sep 19 03:43:01 PDT 2012


> Or should I just delete the code, delete the tests, make sure the
remaining tests don't fail and stop worrying about it?

That's the route I usually take. If you're removing functionality that
isn't a complete spike through the system, front to back, it's not a bad
idea to wrap the entire thing in a new test, make that test pass
(presumably making old tests fail), then remove the old code and the old
now-failing tests. Baby steps and frequent checkins will save your butt if
you do miss a beat.

Steven Deobald
C42 -- www.c42.in -- www.rubymonk.com



On 19 September 2012 15:15, Ian Kynnersley <iankynnersley at gmail.com> wrote:

> This is something I regularly come up against and am never sure how best
> to go about it.
>
> I have RSpec coverage for an app I'm making some changes to. The changes
> I'm making are to remove a section of the app.
>
> I can identify which behaviour I'm removing by going through my tests but
> I can't figure out how to test the removal of the functionality. I guess I
> could add a load more tests in to test that the app no longer does
> something but this seems to be complicating the act of removing stuff.
>
> Do I remove the code and ensure that the tests I'm expecting to break do
> indeed break? This doesn't seem like it would be that useful.
>
> I understand the value of the tests showing me whether the changes are
> breaking things I don't want to break but I can't see how to actually
> test-drive the removal of the code. Does anyone have any good experience of
> using TDD for this? Or should I just delete the code, delete the tests,
> make sure the remaining tests don't fail and stop worrying about it?
>
> Thanks!
>
> Ian
>
> --
>
> Ian Kynnersley
> http://iankynnersley.co.uk | http://twitter.com/kpopper
>
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20120919/9782e2bf/attachment-0003.html>


More information about the Chat mailing list