News for hackers. Stuff that matters.
Re:A command line refactoring tool for PHP by Edd314159 on Monday April 08, 2013 @07:26AM (#5511059)
Seems like a neat and very clever tool, but why would you use a test case as an example? Maintainability in unit tests is nowhere near as important as with actual implementation code (refactoring eventually may even hinder the documentary aspect of test code).
Re:A command line refactoring tool for PHP by beberlei on Monday April 08, 2013 @07:40AM (#5511095)
I disagree heavily.

Refactoring tests is as important as refactoring "production" code. Following the four elements of simple design (http://www.jbrains.ca/permalink/the-four-elements-of-simple-...) you can use test refactorings to find better names and detect need for abstractions.

Tests with lots of duplication, for example in the test setup, get hard to maintain and developers tend to abandon them more easily (my own experience).

Re:A command line refactoring tool for PHP by h2s on Monday April 08, 2013 @07:37AM (#5511086)
I respectfully disagree. If you don't treat test code with the same respect as production code, rot sets in. Rot in the test suite discourages programmers from trusting, augmenting and maintaining it, until it eventually stops being used altogether.

The most common type of rot in test code is caused by lazily copy/pasting vast blocks of setup code. The reason this is bad is that when subtle architectural changes break that setup process, somebody has to waste hours fixing 50 tests. Refactoring such code into a setUp method is the usual way of avoiding this.

Re:A command line refactoring tool for PHP by wilmoore on Monday April 08, 2013 @01:19PM (#5513036)
Unfortunately, this is a very common mistake made by those that treat their tests a an after-thought. Tests should be cared for and maintained as much as (or perhaps even more than) the production code.

If tests are difficult to read or reason about, it is much more likely that they will become stale, brittle, or worse, be ignored. If one does not plan to keep tests well-maintained, might as well never add them in the first place.