KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Code evolves, and as it does, it also decays if not pruned, a bit like a garden in that respect. Pruning mean refactoring to make it fulfill its evolving purpose. Refactoring is much safer if we have a good unit test coverage. Test-driven development forces us to write the test code first, before the production code. Hence, we can't test the implementation, because there isn't any. This makes it much easier to refactor the production code. The TDD cycle is something like this: write a test, test fails, write production code until the test succeeds, refactor the code. But from what I've seen, people refactor the production code, but not the test code. As test code decays, the production code will go stale and then everything goes downhill. Therefore, I think it is necessary to refactor test code. Here's the problem: How do you ensure that you don't break the test code when you refactor it? (I've done one approach, https://thecomsci.wordpress.com/2011/12/19/double-dabble/ , but I think there might be a better way.) Apparently there's a book, http://www.amazon.com/dp/0131495054 , which I haven't read yet. There's also a Wiki page about this, http://c2.com/cgi/wiki?RefactoringTestCode , which doesn't have a solution.
Tags (comma-separated)
Save Edits
Cancel