ios 当前未为测试操作配置 Xcode 项目方案

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30481630/
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-08-31 06:05:04  来源:igfitidea点击:

Xcode project scheme is not currently configured for the test action

iosxcodeunit-testingcommand-line

提问by danR

I am trying to run an Xcode unit test for my iOS application. I am willing to do it on an iPad connected via USB to a Mac. I am trying to run the test from the command line in order to trigger it from Jenkins later on.

我正在尝试为我的 iOS 应用程序运行 Xcode 单元测试。我愿意在通过 USB 连接到 Mac 的 iPad 上进行。我正在尝试从命令行运行测试,以便稍后从 Jenkins 触发它。

Below is what I'm currently typing into the command line and the error I'm getting. Please help.

以下是我目前在命令行中输入的内容以及我遇到的错误。请帮忙。

The code:

编码:

xcodebuild test -scheme MyApplication -destination "platform=iOS,name=iPad"

The error:

错误:

Scheme MyApplication is not currently configured for the test action

当前未为测试操作配置方案 MyApplication

回答by David Hunt

For me the problem was that no tests were added to my scheme:

对我来说,问题是我的计划中没有添加任何测试:

Scheme Editor

方案编辑器

By adding test bundles to my scheme via the '+' button then the scheme could be built by Xcode and xcodebuild.

通过“+”按钮将测试包添加到我的方案中,然后该方案可以由 Xcode 和 xcodebuild 构建。

回答by dan

For everyone struggling with this problem.

对于每个在这个问题上挣扎的人。

My solution was to:

我的解决方案是:

  1. Select Test Target
  2. Manage Scheme
  3. Select Runin the left menu
  4. Select Infoin the tab
  5. Choose Executable Targetfrom the dropdown menu
  6. Hit Close.
  1. 选择测试目标
  2. 管理方案
  3. 在左侧菜单中选择运行
  4. 在选项卡中选择信息
  5. 从下拉菜单中选择可执行目标
  6. 点击关闭

回答by danR

Fixed this up by removing duplicate schemes from Xcode. The schemes can be added/removed/shared/edited in Xcode via Product -> Scheme -> Manage Schemes.

通过从 Xcode 中删除重复的方案来解决这个问题。可以通过Product -> Scheme -> Manage Schemes在 Xcode 中添加/删除/共享/编辑方案

回答by MiladTai

  • You should check your workspace data on Jenkins and see which *.xctest is already uploaded. Then you have to rename your UI/Unit test target to that *.xctest data in your xcode project like what you have on Jenkins and then push again.
  • OR wipe out your workspace from Jenkins and push all data again with new UI/Unit test target again.
  • 你应该在 Jenkins 上检查你的工作区数据,看看哪个 *.xctest 已经上传了。然后,您必须将您的 UI/单元测试目标重命名为 xcode 项目中的 *.xctest 数据,就像您在 Jenkins 上拥有的那样,然后再次推送。
  • 或者从 Jenkins 中清除您的工作区并再次使用新的 UI/单元测试目标再次推送所有数据。

(Of course you have to ensure that you have already made a scheme for project.)

(当然你要保证你已经做好了项目的方案。)

回答by Charly

In my case I had no test file...

就我而言,我没有测试文件...

Here is a tutorial to perform UI Tests and create screenshots :

这是执行 UI 测试和创建屏幕截图的教程:

https://krausefx.com/blog/run-xcode-7-ui-tests-from-the-command-line

https://krausefx.com/blog/run-xcode-7-ui-tests-from-the-command-line

回答by Aleksey Tsyss

Your test plan should have at least one custom configuration.

您的测试计划应该至少有一个自定义配置。

回答by KVISH

My problem was that the Tests.swiftfile was importing a module that no longer existed (I renamed the Targets for the project). Check to make sure all test files are importing currently existing modules.

我的问题是该Tests.swift文件正在导入一个不再存在的模块(我重命名了项目的目标)。检查以确保所有测试文件都在导入当前存在的模块。