Unit Testing with SenTestingKit: Check if On?
I have some NSLog
calls that I do to keep myself from flying blind in my 开发者_运维问答unit tests. I can see them in the Build Results window, which works out nicely. Now I'd like to NOT run these except in the unit testing context (for instance, the target?). Is there a standard way to know if I'm inside a Unit Test or not?
I don't know of a standard way, but you could define a preprocessor value in your test target and write your own log function to have the preprocessor strip the logging if that value is not defined.
精彩评论