3 ms·
A 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
by IgorPartola 4y ago
A 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.