3 ms·
> You also seem optimistic, unit test don't catch new bugs. You write a new unit test using the data which caused the bug but expecting a non-error state. The
by lhnz 10y ago
> You also seem optimistic, unit test don't catch new bugs.
You write a new unit test using the data which caused the bug but expecting a non-error state. The error that is being thrown/rejected will have a stack trace you can inspect to find the line which threw. To find the real cause you need to read the code before this to find out how the bad state was created.
If you kept things small and simple, it is not so difficult to work out what went wrong. If you let things grow in complexity too much, you can however end up within a breakpoint/log quagmire.
- mattmanser 10y agoIn the idealized functional world that doesn't exist, maybe. Programming anything beyond a small app is ultimately managing complexity and often fixing how the various moving parts don't quite work together as you intended. You simply can't, and shouldn't, unit test that stuff.