iOS: how to run XCTest on device?

﹥>﹥吖頭↗ 提交于 2019-12-12 16:09:17

问题


I currently learning XCTest for the purpose of unit testing. I was able to run the default template XCtest on the simulator without any problem. I could all the green ticks in the test navigation view. However, when I ran them on the device with my app as host application, nothing happens. My app was launched on the device and the XCTest did not seem to run. I even put a break point in the test and it did not break. Also, in the simulator, the app automatically stops when tests finish, however, when running on device, my app was just kept running and never put to a stop. Am I doing something incorrect?


回答1:


xCode should show this message when running XCTest on a physical device.

Logic Testing on iOS devices is not supported. You can run logic tests on the Simulator.




回答2:


There's a library called GHUnit we can run unit tests on iphone device. Internally it uses xctest. Here is how you setup GHUnit.

I was able to follow the instructions and setup unit tests using xcode 5. should be okay with Xcode 6?



来源:https://stackoverflow.com/questions/29077155/ios-how-to-run-xctest-on-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!