将单元和 UI 测试添加到 Xcode 7 中的现有项目
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34744508/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Adding Unit and UI tests to an existing project in Xcode 7
提问by an earwig
Lets say I have an existing project in Xcode, and for whatever reason, did not add Unit Tests or UI Tests. Can I add the test projects to the project later in Xcode 7?
假设我在 Xcode 中有一个现有项目,无论出于何种原因,都没有添加单元测试或 UI 测试。我可以稍后在 Xcode 7 中将测试项目添加到项目中吗?
回答by Chris Droukas
回答by vadian
Tests are targets.
测试是目标。
Select the project in the navigation view then Menu File
> New
> Target…
and Test
of the proper SDK.
在导航视图中选择项目,然后选择Menu File
> New
>Target…
和 Test
合适的 SDK。
Choose UI Testing Bundle
or Unit Test Bundle
.
选择UI Testing Bundle
或Unit Test Bundle
。
Repeat the procedure to add the other test bundle.
重复该过程以添加另一个测试包。
回答by yoAlex5
One more variant Xcode 10.2.1
using Test Navigator
另一种变体Xcode 10.2.1
使用Test Navigator
- ? Command+ 6or
View -> Navigators -> Show Test Navigator
Right click
or+
at the bottomNew Unit Test Target...
orNew UI Test Target...
- ? Command+6或
View -> Navigators -> Show Test Navigator
Right click
或+
在底部New Unit Test Target...
或者New UI Test Target...
回答by Preetha
Follow this steps,it works's fine
按照这个步骤,它工作正常
1.Select the project.
1.选择项目。
2.Targets->Click the + button->Add iOS UITesting Bundle or iOS UnitTesting Bundle.
2.Targets->点击+按钮->添加iOS UITesting Bundle或iOS UnitTesting Bundle。