Interview Questions

Do You Have To Write a Test for Everything?

JUnit Questions and Answers


(Continued from previous question...)

Do You Have To Write a Test for Everything?

No, just test everything that could reasonably break.

Be practical and maximize your testing investment. Remember that investments in testing are equal investments in design. If defects aren't being reported and your design responds well to change, then you're probably testing enough. If you're spending a lot of time fixing defects and your design is difficult to grow, you should write more tests.

If something is difficult to test, it's usually an opportunity for a design improvement. Look to improve the design so that it's easier to test, and by doing so a better design will usually emerge.

(Continued on next question...)

Other Interview Questions