Oracle has decided to add Conditional Compilation to Oracle 10g Release 2. As Bryn Llewellyn states in his white paper Conditional Compilation in Oracle Database 10g Release 2: Unusually, but for very compelling reasons, the feature has been made available in patchsets of releases of Oracle Database earlier than the one that introduced the feature. It is available in Oracle 10g Release 1 (10.1.0.4.0) and if you have the right support contract, it can even be turned on Oracle 9i (184.108.40.206).
The idea behind Conditional Compilation is, in my opinion, two (or more) fold. One way to use this is to use new code possibilities in existing packages. Packages that need to run on different versions of the database. Another way to use it, might be to add debug code to your package, which should not be run in a production environment unless there is a problem.
Now, how do you test all this code. For example using Quest CodeTester for Oracle. In CodeTester it is possible to have only one test set per piece of code. So, what if you want to test both versions of your code (or even more possible versions if you have multiple flags in your code). CodeTester relies on the existing package and it cannot read the 'hidden' code. So, if a function becomes private, due to a compiler flag being (un)set, then the test package will become invalid. So, for testing purposes you want all the programs to be visible and you want all the flags turned on that will be turned off in production.
I would like to add a helper package though, in which I can read all the compiler flags and according to the state of those flags execute a test or not. However, there is currently no possibility to enable/disable tests on this level. There is a setup procedure (and teardown) for every test, but this is a procedure that will be called before the test runs. You also have a possibility to run code before (and after) all the tests are run. What you would want is a 'before test' and an 'after test' piece of code. This way you would be able to enable/disable certain testcases depending on the state of parameters (or package variable values). Maybe this will be possible in a future version of the product.