Keep adding and maintaining unit tests with good code coverage preferably as part of Continuous integration.