Hacker News new | past | comments | ask | show | jobs | submit login

If you're not testing the code you are refactoring how do you know it still works or even worked in the first place?

There are other ways, different than testing, to convince yourself and others that a program does what it is meant to do. They complement testing. You use them already while constructing the deterministic parts of your program: much of what the machine does for you is predictable, and good languages and libraries are designed to make it so.

In fact, tests won't tell you that the program works, only that it doesn't fail the test cases. You then use the predictable aspects of your domain to convince yourself that the program works if it doesn't fail those test cases.

In the same way that programmatically renaming a variable does not usually warrant the writing of a test case, many forms of automatic refactoring are theoretically guaranteed to not break your program. If they involve type renames, you might be able to deduce that any resulting errors will be caught by the type checker.

(Please don't take this as an argument against testing, but against always requiring test coverage)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: