Software testing and regression testing
Drupal 7 comes with a Testing module, and for Drupal 6 you can download http://drupal.org/project/simpletest.

It doesn't do anything automatically (how could it..) but it allows you to write automated tests that test the functionality of your custom modules.

I wrote a blog post about this a while ago: Writing automated tests for Drupal 7. Even though the title says Drupal 7, most of it applies to Drupal 6 too. See Simpletest documentation on drupal.org for more information.