如何在 IOS 测试中 运行 这个标志,--test-targets?

how to run this flag in IOS tests, --test-targets?

我正在尝试 运行 IOS 的 xctest 测试,但是当我想在测试实验室中 运行 单个 class 时遇到问题firebase,但是我项目中的所有 classes 仍然是 运行ning,我需要 运行 一个 class,这可能吗?

如果您使用 gcloud 命令行工具来创建测试矩阵,这是可能的。

在 .xctest运行 文件的副本中指定您希望 运行 的测试(与使用 [=18] 在本地 运行ning 测试时的方式相同=]),并使用以下方法传递修改后的 xctest运行 文件:

gcloud firebase test ios run --test=<your test zip> --xctestrun-file=<your customized .xctestrun file>

我不确定我是否完全理解你的问题,但我认为你正在寻找的是这个:

xcodebuild test -workspace [MyApplication.xcworkspace] -scheme [yourScheme] -destination 'platform=iOS Simulator,name=iPhone X,OS=11.4' -only-testing:[Target/Class/testExample]

你不必输入 testExample,只输入 class,它会 运行 整个 class,如果你添加 /testMethod,它会 运行 只有那个测试。 Here您可以查看更多信息。

另一种方法是创建一个方案,您 select 仅测试您想要 运行,然后您 运行 仅该方案。做起来也很简单。看这里:http://artsy.github.io/blog/2016/04/06/Testing-Schemes/