You can do it in a simpler way, not compiler directives but in your main process globals you can have:
Dim isTest as Boolean = True
Then throughout your app you can be doing:
If Main.isTest = True then
Do testy type things Here
End If
Then when you want to compile the 'non test' version you change isTest to False