Why should I use a separate test host for running XCTests and how should I do that?

允我心安 提交于 2019-12-01 06:11:07

Reasons to use a different host app for unit tests:

  1. There is no main app, because your target is a library.
  2. When the main app is launched, it goes through its start-up process. This takes too long, and has side-effects.

Reason 1 is pretty much a given. But what about reason 2?

My approach is to use the main app, but use a different application delegate during testing. That way I don't have to maintain a separate app, just an alternate start-up process. See How to Easily Switch Your App Delegate for Testing

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