I am writing test cases for my camera application.
For instance, I want to provide a mock object when the tests are running in Simulator. I could not use macro to run the corresponding code like this:
#if TARGET_OS_SIMULATOR
vc.camera = mockCamera
#endif
What is the better way to do this?
You cannot test if the app is running in test via macro. You can test it in runtime via NSProcessInfo
:
[[NSProcessInfo processInfo] environment]["XCInjectBundle"]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.