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

I don’t write automated tests and none of my developers do, except the guy building smart contracts. And yet I am not sure I am doing the right thing. We only did it because we couldn’t afford the extra time and money to do it.

If a test never fails, is it a good test? If I have to change a test everytime I change the implementation, is it a good test? Writing good tests is really difficult.

Yes — just like good interface is not noticed, or how good security which prevents issues isn’t noticed when things go well.




I had a hard time writing tests because nobody else around me did it. Nobody taught me how to implement good tests or implement testable code. I had to figure it out by myself through trial and error, and through reading articles and watching videos.

Ultimately, I found writing tests were immensely helpful for the work I was doing. I was writing the API backend for desktop/mobile apps to call. When one of the guys working on the client apps would claim my stuff wasn't working right, I demanded an example HTTP request that I could use to reproduce the problem.

Most of the time they never got back to me. Often the problem was with their (untested) code and they wanted to throw the problem over the wall for someone else to investigate. I had the confidence that my code was behaving well because of the tests. So when someone else came over and said "Your stuff is broken" I had the confidence to say "Prove it".

With that said, I recognize that there are cases that are lower stakes that may not require such thorough testing. Right now I have some APIs I maintain that I don't write tests for. These APIs are of the type where if there's a bug then the user of the API says "Hey, it's broken" and I say "Ok, I'll fix it in a couple days" and he says "Sure, let me know when it's done". This is quite different than the API that gets called hundreds of times a second and customers are screaming "I want my data now!"




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: