I never write assert
s. Instead, I do Unit Testing and Integration Testing etc against real production code.
I don't like using assert
because their ability to detect problems are somewhat limited, and I'm paranoid about unintended side effects.
I very much don't like having conditionals in the code which compile certain things in or out depending on build flags such as Development vs Production. These conditionals only serve to complicate the code, and they have to potential to make it so that the code that you test is not the same as the code in production.
Personally my feeling is that the only code that should be written in the actual business module is production-level code, and all testing should be done against that. No changes should ever be made to the business model for the purposes of testing. ie, if you want to test something, make it public
and write an external test for it.