3 ms·
Unit Tests are a colossal waste of time 80% of the time, and at least 80% of that time should be spends in thinking how to make your system debuggable.
by oxff 4y ago
Unit Tests are a colossal waste of time 80% of the time, and at least 80% of that time should be spends in thinking how to make your system debuggable.
- jjgreen 4y agoThe problem is, you don't know which 80%
- IgorPartola 4y agoA good rule of thumb is that if a unit test was easy to write then it is useless because either the code it’s testing is so simple that it will never change and/or does not warrant testing, or that the unit test itself isn’t actually doing anything useful (for example it could just be doing an echo test on a function that does something very complex). There are some things that are absolutely worth testing. For example my current project is a library that calculates payroll taxes for US employers. This stuff is self contained, stateless, idempotent, but complex. And yet I know what kinds of inputs are non-trivial and can calculate the outputs by hand, so I can test it. On the other hand, testing that CRUD form that submits data to S3 as well as saving it in the local database is nearly useless. Run through the form when you update it manually and make sure it works. S3 semantics change rarely, your own database changes would necessitate you changing the corresponding form.
- snovv_crash 4y agoIt depends on your field and architecture. Functional-ish design lends itself well to unit tests, where you have known expected inputs and outputs. CRUD apps, not so much.
- fsloth 4y agoDisagree, but depends on context. When you have a complex monolith, unit tests and static typing allow you to create features and refactor the code fearlessly ("Computer says no" is a good thing here). For example, a decades old cad product with millions of lines and tens of developers doing parallel changes. The unit tests allow the continuous integration system to dish out isolated reports on failing tests before pullrequest is merged to main, instead of integration test just bombing at some random place. Unit tests save time.
- ogoparootbbo 4y agorepls a key item in your ideal list of requirements when it comes to building a system?