Seven Principles of Great Unit Tests — Adapted For Android
https://proandroiddev.com/seven-principles-of-great-unit-tests-adapted-for-android-342515f98ef2
When it comes to software engineering it’s usually easy to find sources about how to write good code that is ready for production. You can look into Clean Architecture or SOLID Principles (or both) and have a good idea of how to reliably write good code. However when it comes to writing good unit tests I’ve found we tend to throw good engineering practices out the window. What’s even worse is testing on Android still isn’t commonplace, this has resulted in lackluster information about how to test on the platform. So with all of that out of the way, what are the seven principles of great unit tests?
One of the major benefits of writing unit tests is it allows you to document how your code should work (as well as prove it actually works). The only way you can take advantage of that benefit is if your tests are fast. Engineers are impatient (as most people are), if it takes more than a second to verify your code works there is little chance you will want to run them with any sort of frequency. Running tests frequently is crucial to finding regressions in your code, the longer you wait, the more time you’ll spend figuring out why a test is failing.