将单元测试添加到现有项目中? [英] Adding Unit Tests to an already existing project?

查看:110
本文介绍了将单元测试添加到现有项目中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

创建XCode 4项目时,它会询问您是否要包含单元测试。但是,如何将它添加到没有它们的项目中呢?

When you create an XCode 4 project, it asks you if you want to include unit testing. But how do you add it to a project that's been created without them?

我启动了一个带有单元测试的项目来试图找出它,看起来它和我现有的项目之间的唯一区别是Test.h和Test。新项目中的m个文件。

I started a project with Unit Tests to try to figure it out, and it looks like the only difference between it and my existing project are the Test.h and Test.m files in the new project.

但当我将它们移动到我的旧项目并尝试构建时,它说没有这样的文件或目录:SenTestingKit / SenTestingKit.h。这对我来说看起来像一个框架,但是如果我去构建阶段并尝试添加框架,那么就没有一个可用的SenTestingKit :(新项目只链接常见的嫌疑人:UIKit,CoreGraphics和Foundation,但是没有SenTestingKit。

But when I move them into my old project and try to build, it says no such file or directory: SenTestingKit/SenTestingKit.h. That looks like a framework to me, but if I go to build phases and try to add the framework, there isn't one available called SenTestingKit :( And the new project only links the usual suspects: UIKit, CoreGraphics, and Foundation, but no SenTestingKit.

推荐答案

我认为你可以这样做:


  1. 打开您的Xcode项目

  2. 打开目标

  3. 点击添加目标按钮

  4. 点击其他

  5. 选择Cocoa Touch Unit Test Testing Bundle

  1. Open your Xcode project
  2. Open targets
  3. Click "Add Target" button
  4. Click "Other"
  5. Select "Cocoa Touch Unit Test Testing Bundle"

这篇关于将单元测试添加到现有项目中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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