80% of code coverage is a common number expected by QA departments. Such a metric is relatively easy to achieve:
- Test simple things first. The simpler, the better.
- Don't use asserts. They don't influence the code coverage and just break the build.
- Don't use
fail, and do not re-throw exceptions - just swallow them.
- Sometimes you will have to split complex methods into smaller ones. Names don't matter. Its additional effort, but will increase your code coverage. Goto 1.
:-). Although I never saw all four items in the "field", the use of System.out.println instead of asserts becomes increasingly popular idiom. It is very easy to satisfy the QA department and write completely unmaintainable code at the same time :-).
Web Apps, SPA, PWA with vanilla Java Script (ES 6+), CSS 3 and WebStandards only. As simple as possible, but not simpler. See you at: (Progressive) Web apps, Single Page Apps and WebStandards airhacks workshops at MUC airport, Winter Edition
airhacks.fm the podcast:
Stay in touch: airhacks.news.