Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I have colleagues that take DRY to an extreme when it comes to tests. There are so many levels of abstractions that it's incomprehensible. Tests should be clear and readable, you shouldn't have to dig code to understand _what_ a test is doing.


Tests in particular SHOULDN'T be DRY, IMO. They need to be very much independently modifiable quickly; they're meant to be quirky end-runs around your bespoke, artisinal architecture to get at all the interesting bits. Repetition there is fine.


I dunno. I think a few helper methods helps a lot in tests - like if you have a common operation in the setup portion. I don't think the code needs to be super abstract, but it shouldn't all be hand typed out.


A downside of this approach is that sometimes when you make a small implementation change, you need to rewrite 50 unit tests.




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

Search: