How to SimpleTest a module's use of drupal_alter() or module_invoke_all()? I'm developing a custom module.  My module calls drupal_alter() with a $type unique to my module, so other modules can alter the behavior of my module.

I'd like to write a SimpleTest for my module, which includes a test implementation of the hook my module calls.  This hook implementation should only be used by my SimpleTest; it should not apply when the module is installed on a full Drupal installation (so therefore I can't place my test hook implementation in the .module file).

What's the right way to do implement a hook that only applies to an active SimpleTest?
You can create a test module and place hidden = TRUE in the .info file.

This will hide the module in the user interface but you can still enable it in your setUp() method.

See http://drupalcode.org/project/drupal.git/blob/refs/heads/7.x:/modules/file/tests/file_module_test.info for an example.