Skip to content

Translation 🌍

You can translate or improve the translation of this page.

Contribute

Xcode 项目

警告要求

:::

您可以通过命令行有选择地运行 Xcode 项目的测试。为此,您可以在xcodebuild 命令前加上tuist - 例如,tuist xcodebuild test -scheme App 。该命令会对您的项目进行散列,并在成功后持久化散列,以确定在未来的运行中发生了哪些变化。

在以后的运行中,tuist xcodebuild test 会透明地使用哈希值来过滤测试,只运行自上次成功运行测试以来发生变化的测试。

例如,假设依赖关系图如下:

  • FeatureA 有测试FeatureATests ,并依赖于核心
  • FeatureB 有测试FeatureBTests ,并依赖于核心
  • 核心 有测试CoreTests

tuist xcodebuild test 会有这样的表现:

行动描述内部状态
tuist xcodebuild test invocation运行CoreTests,FeatureATestsFeatureBTests 中的测试FeatureATestsFeatureBTestsCoreTests 的哈希值被持久化。
功能A 已更新开发人员修改目标代码和以前一样
tuist xcodebuild test invocation运行FeatureATests 中的测试,因为它的哈希值已更改FeatureATests 的新散列值被持久化
核心 已更新开发人员修改目标代码和以前一样
tuist xcodebuild test invocation运行CoreTests,FeatureATestsFeatureBTests 中的测试FeatureATests FeatureBTests ,以及CoreTests 的新散列值被持久化。

要在您的 CI 上使用tuist xcodebuild test ,请遵循

持续集成指南中的说明。

请观看以下视频,了解选择性测试的实际操作:

Released under the MIT License.