I need to disable the logging when running unit testing automatically so that the test speed can be significantly improved(~20s vs 0.374s, only a few tests right now, but a big loop in the testing code).
I tried to define a macro in the testing code header, like this:
#define UNIT_TESTING
And in the code to be tested, I first check if such macro is defined:
#ifndef UNIT_TESTING
NSLog("whatever log");
#endif
But it seems not working, I'm guessing if it's because I didn't import the testing code header in the code to be tested. I can't do this because then the log won't be printed even when not unit testing.
I'm relatively new to objective c and came from Java background, I guess there is something wrong with header/macro definition.
One more question is, do I ever need to define a macro for unit testing, isn't there anything already like that?