3 ms·
1. Tools like Hypothesis (https://hypothesis.readthedocs.io https://hypothesis.readthedocs.io) and other QuickCheck-inspired libraries are really good for gener
by itamarst 10y ago
1. Tools like Hypothesis (https://hypothesis.readthedocs.io https://hypothesis.readthedocs.io) and other QuickCheck-inspired libraries are really good for generating lots of fake, realistic data.
2. Only test public interfaces
3. Only test things you want to be stable.
4. Most code has two parts, purely functional calculation and calls to outside world. Depending on where tricky bits are, focus on first part.
5. If testing is hard, cheat. Big picture covers-everything test. Then once you have some coverage you can refactor and see if you can make code more testable.
More ideas on what to do when testing is a pain: https://codewithoutrules.com/2016/02/21/painfultesting/ https://codewithoutrules.com/2016/02/21/painfultesting/