FindXCTest

在 3.3 版本中添加。

用于帮助创建和执行 XCTest bundles 的函数。

XCTest bundle 是一个具有特殊 product-type 和 bundle 扩展名的 CFBundle。Mac 开发者库在 使用 Xcode 进行测试 文档中提供了更多信息。

模块函数

xctest_add_bundle

xctest_add_bundle 函数创建一个名为 <target> 的 XCTest bundle,它将测试目标 <testee>。testee 支持的目标类型是 Frameworks 和 App Bundles

xctest_add_bundle(
  <target>  # Name of the XCTest bundle
  <testee>  # Target name of the testee
  )
xctest_add_test

xctest_add_test 函数将一个 XCTest bundle 添加到项目中,以便由 ctest(1) 运行。测试将被命名为 <name> 并测试 <bundle>

xctest_add_test(
  <name>    # Test name
  <bundle>  # Target name of XCTest bundle
  )

模块变量

以下变量通过包含此模块来设置

XCTest_FOUND

如果找到了 XCTest Framework 和可执行文件,则为 True。

XCTest_EXECUTABLE

用于执行 XCTest bundles 的 xctest 命令行工具的路径。

XCTest_INCLUDE_DIRS

包含 XCTest Framework 头文件的目录。

XCTest_LIBRARIES

XCTest Framework 的位置。