Home > Articles > Programming > Java

  • Print
  • + Share This
Like this article? We recommend


The JUnit API provides a very flexible and simple framework for a developer to make sure that the code that is written is robust. The more checks you build into your unit tests, the better the quality of the final product. Follow the TDD approach: You write a test, run all the tests, observe the new one fail, fix the code to make the test pass, and refactor to remove any duplication. Repeat the cycle through your development cycle. Focus the tests on the areas that have the highest probability of bugs. If we are developing a system, we should write the tests first. That way, we will know that we are done developing when the test runs. Similarly, when we are debugging, we should write the tests that we know should work when the bug has been resolved. Then we can debug the system more effectively until the test passes.

  • + Share This
  • 🔖 Save To Your Account