简体   繁体   English

如何导入XCTest套件

[英]How to import XCTest suite

I've created my project without XCTest support. 我创建的项目没有XCTest支持。 But now after long time development i want to cover my project with unit tests. 但是现在经过长时间的开发,我想用单元测试覆盖我的项目。 And i want do it with XCTest . 我想用XCTest做到这XCTest

How to import XCTest suite into existing project previously created without XCTest support ? 如何将XCTest套件导入以前没有XCTest支持的现有项目中?

You can add new Unit/UI test case classes through "file-> new-> file -> UI test case class or Unit test class". 您可以通过“文件->新建->文件-> UI测试用例类或单元测试类”添加新的Unit / UI测试用例类。 Make sure that the target membership is set for only the test target and not the regular targets (you can see that in the file inspector). 确保仅为测试目标而不是常规目标设置了目标成员身份(您可以在文件检查器中看到)。 If you currently have no test target, you can add that through "file -> new -> target -> iOS UI testing bundle or iOS Unit Testing Bundle" and add relevant files to the this target. 如果当前没有测试目标,则可以通过“文件->新建->目标-> iOS UI测试包或iOS单元测试包”将其添加,然后将相关文件添加到该目标。

Adding XCTest target to an existing project is simple you can refer 将XCTest目标添加到现有项目很简单,您可以参考

https://automationwithaditya.wordpress.com/2017/08/21/getting-started-to-xctest-automation-framework/ https://automationwithaditya.wordpress.com/2017/08/21/getting-started-to-xctest-automation-framework/

or follow the steps 1. Click on project 2. Add the target choose the one which you want. 或按照以下步骤操作:1.单击项目2.添加目标,选择所需的目标。 Follow this image 跟随这张图片

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM