Buy @ Amazon

Top 12 Unit Testing Gotchas

How does safety look like when done for compliance sake?
How does safety look like when done for compliance sake?
01. Using a database.
02. Using a file system.
03. Using a network, say for accessing a 3rd-party API.
04. Having multiple assertions for a unit-test case.
05. Having dependency on other unit-tests to be run.
06. Having to do complex set-up of object dependencies of your test subject.
07. Having no assertions.
08. Having dummy assertions to pass tests.
09. Commenting out failing unit-tests.
10. Complicating your unit-test suite by over-engineering.
11. Abusing Mocks to get done with your job quickly and dirtily.
12. Abusing Code-Coverage tools to satisfy org policies.

Don't do Unit Testing for compliance sake. Do it because it helps you to be productive and saves you from embarrassment at the very least. If you have trouble appreciating this practice, you should invest your time learning to do it the right way. Happy learning!!..