Writing Characterization Tests




Source: Feathers, Michael. Working Effectively With Legacy Code (WELC), Prentice Hall PTR, 2005.


Test-after development (TAD) is tough; dependencies and non-cohesive code can make for a significant challenge. That's why Michael Feathers' book Working Effectively With Legacy Code is so useful.


Does working with legacy code really require a different set of skills than doing TDD? Well, sprout method and sprout class are the first avenues you should always explore, and they are strictly about test-driving the new code. But most of the other WELC techniques require less test driving and more digging about, trying different things. Some of the techniques even border on being too clever--they're about problem solving, and you do what you gotta do!


An important step in modifying existing code is understanding what it does before you make any changes. Feathers says characterization tests are like putting a vise around code: You want to pin it down before you attempt changing it, so that you know if it slips a bit when you do. So in a sense, we are back to test-first.


How many characterization tests do you need to write? You can read the WELC chapter on effects analysis, and start to get scared that you're going to have to write a lot of tests. Or you can use confidence as a guideline, writing as many tests as you think you need to understand the code you're about to change.


The flash card describes what are pretty obvious steps, but they back one of the underlying themes in Feathers' book: be methodical, be safe.

9 comments:

  1. Do not live in make it difficult. live life for what it is then surely life will be wonderful.

    ReplyDelete
  2. maintain the security of yourself is very possible from current threats.

    ReplyDelete
  3. la technologie d'aujourd'hui rend la vie plus facile à passer. Toutes les activités peuvent être réalisées en toute simplicité grâce à la dernière technologie

    ReplyDelete
  4. today's technology makes life easier to be passed. all activities can be done with ease thanks to the latest technology

    ReplyDelete
  5. mantener la seguridad de uno mismo es muy posible de las amenazas actuales.
    Evercoss A7S
    Harga Evercoss A7S
    Spesifikasi Evercoss A7S

    ReplyDelete
  6. "Writing Characterization Tests" is good of the topic, thank you for sharing :)
    Furniture Jepara

    ReplyDelete
  7. Came looking for standard cell characterization, google says www.paripath.com.

    ReplyDelete
  8. I was very encouraged to find this site. I wanted to thank you for this special read. I definitely savored every little bit of it and I have you bookmarked to check out new stuff you post.

    ReplyDelete