带有 Xcode 工作区的 Team City CI - 方案“我的方案”未配置为运行

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17110633/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 03:30:01  来源:igfitidea点击:

Team City CI with Xcode workspace - Scheme "My Scheme" is not configured for running

iosxcodecontinuous-integrationteamcityteamcity-7.1

提问by Ossir

I have a workspace with few projects that must be built as static libraries and I have schemes with tests for them. I want to configure TeamCity to build and test each of those libraries, but it does not work with following error:

我有一个工作区,其中包含几个必须构建为静态库的项目,并且我有针对它们的测试方案。我想配置 TeamCity 来构建和测试每个库,但它不会出现以下错误:

...
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace code/MyApplication/My Framework.xcworkspace -scheme One Of Tests TEST_AFTER_BUILD=YES clean build -configuration Debug -sdk iphonesimulator6.1
in directory: /Users/Me/TeamCity/buildAgent/work/d0f083d874fc6891
Build settings from command line:
    SDKROOT = iphonesimulator6.1
    TEST_AFTER_BUILD = YES
xcodebuild: error: Failed to build workspace My Framework with scheme One Of Tests.
    Reason: Scheme "One Of Tests" is not configured for running.
Process exited with code 70
...

But at the same moment, when I clone my repository, cd into it and run command from above in terminal:

但与此同时,当我克隆我的存储库时,将 cd 放入其中并在终端中从上面运行命令:

/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace code/MyApplication/My Framework.xcworkspace -scheme One Of Tests TEST_AFTER_BUILD=YES clean build -configuration Debug -sdk iphonesimulator6.1

It succeeds: // UPDATE:It worked only for build schemes, not for tests

它成功了: //更新:它仅适用于构建方案,不适用于测试

** BUILD SUCCEEDED **  

So it's definitely wrong settings in TeamCity. What can I try to make it works?

所以这绝对是 TeamCity 中的错误设置。我可以尝试什么使它起作用?

P.S. Schemes for building libraries work fine. Only with tests throw errors.

用于构建库的 PS 方案工作正常。只有测试抛出错误。

采纳答案by Ossir

I found solution. The problem was about poor support of SenTestKit with xcodebuild command. To make it works I had to go Edit Scheme menu and set Run step so the test scheme became runnable.

我找到了解决方案。问题在于 xcodebuild 命令对 SenTestKit 的支持不佳。为了使它工作,我必须进入编辑方案菜单并设置运行步骤,以便测试方案变得可运行。

Thanks for solution this article. There're few things was actually different, it is a Test After Build setting and macros. In my case it runs test only with YES option and I did not have to write any macros. Mb they fix the issue that was described in the article.

感谢这篇文章的解决方案。实际上几乎没有什么不同,它是构建设置和宏之后的测试。在我的情况下,它仅使用 YES 选项运行测试,我不必编写任何宏。Mb 他们解决了文章中描述的问题。