现有项目的 XCTest [英] XCTest for existing project

查看:27
本文介绍了现有项目的 XCTest的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个很大的(大约 700 个模块)iOS 项目.现在我需要对现有代码进行单元测试(在我们没有使用它之前).我为我的目标添加了新的 XCTest 测试目标并开始编写我的第一个测试.但是编译后我遇到了一些链接错误,因为我的项目中的模块没有包含在测试目标中.我是否将所有模块都包含在测试目标中?或者有更简单的方法来制作测试目标?

I have a big(about 700 modules) iOS project. Now I need to make unit tests for existing code(before we didn't use it). I've added new XCTest test target for my target and started to write my first test. But after compilation I've got some link errors, because modules from my project weren't be included to test target. Have I include all my modules to test target? Or there is easier way to make test target?

推荐答案

应用程序文件 不要 需要包含在 XCTest 目标中.XCTest 目标的编译源"列表中只应包含测试文件.

Application files DO NOT need to be included within XCTest targets. Only test files should be included within the 'Compile Sources' list for your XCTest target.

按照 Apple 说明将 XCTest 添加到您的项目中.

Follow the Apple instructions to add XCTest to your project.

在应用程序目标中,确保编译器选项Symbols hidden by default"设置为NO.

Within the Application target, make sure the compiler option "Symbols hidden by default" is set to NO.

这里 是一篇博客文章,如果您遇到困难,可以提供屏幕截图!

Here is a blog post with screenshots if you get stuck!

这篇关于现有项目的 XCTest的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆