▲ | latchkey 4 days ago | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
You run your code in production, you see it is deadlocking and you fix it. How do you fix it? You write a test the reproduces the deadlock, you fix the code and your test passes. Just like any other testing. I'm not arguing that you magically predict everything that's going to happen. But, without those tests and the culture of writing tests and writing your code to be testable, you're screwed when you do have bugs in production. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | tmoertel 4 days ago | parent [-] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
What you wrote was "you write tests so that you know your code works," but what you seem to have meant is "you write tests so that you when you get burned in production by problems that your tests didn't anticipate, you can write more tests at that time to make sure those newly discovered problems don't burn you again." That's nice, but it's far from "knowing your code works". When code works, it doesn't burn you in production. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|