Testing should be done early and often. Testing is a continuous process that should be performed at each stage of software development. A robust approach to testing in [[software engineering]] is [[test driven development]]. Typically industry software has 1 - 10 defects per thousand lines of code. The earlier a bug is found in the development of the code base, the less likely it will be very expensive to fix. Many data scientists are accustomed to writing code in notebooks and printing out results to screen for debugging. A good habit of testing (like [[test driven development|TDD]]) can help you and your team transition to a more robust software engineering practice. Testing in [[Python]] is done with the core library `unittest` or [[pytest]] (recommended). Testing in [[Java]] is done with [[JUnit]] (however other libraries are available).