【问题标题】:iOS Earl Grey - select missing argumentiOS 伯爵茶 - 选择缺少的参数
【发布时间】:2017-06-02 15:01:29
【问题描述】:

我通过 CocoaPods 将 EarlGrey 添加到我的 iOS 项目中。我创建了新目标,如下所述:https://github.com/google/EarlGrey/blob/master/docs/install-and-run.md

我的问题是,按照这个说明,简单的 EarlGrey swift 测试被错误解释并导致构建错误

有人遇到过这样的问题吗?有什么办法可以解决吗?

由于我是 iOS/EarlGrey 的新手 - 请随时向我提出任何我可以添加到这个问题以使其更具体的建议。

在 cmets 之后编辑

在执行gem install earlgrey 之后,pod install 命令会导致以下错误:

RuntimeError - Test target group not found!
/Users/karolgil/.rvm/gems/ruby-2.1.10/gems/earlgrey-1.9.3/lib/earlgrey/configure_earlgrey.rb:371:in `copy_swift_files'
/Users/karolgil/.rvm/gems/ruby-2.1.10/gems/earlgrey-1.9.3/lib/earlgrey/extensions/analyzer_extensions.rb:25:in `block (2 levels) in analyze'
/Users/karolgil/.rvm/gems/ruby-2.1.10/gems/earlgrey-1.9.3/lib/earlgrey/extensions/analyzer_extensions.rb:24:in `each'
/Users/karolgil/.rvm/gems/ruby-2.1.10/gems/earlgrey-1.9.3/lib/earlgrey/extensions/analyzer_extensions.rb:24:in `block in analyze'
/Users/karolgil/.rvm/gems/ruby-2.1.10/gems/earlgrey-1.9.3/lib/earlgrey/extensions/analyzer_extensions.rb:23:in `each'
/Users/karolgil/.rvm/gems/ruby-2.1.10/gems/earlgrey-1.9.3/lib/earlgrey/extensions/analyzer_extensions.rb:23:in `analyze'
/Users/karolgil/.rvm/gems/ruby-2.1.10/gems/cocoapods-1.2.1/lib/cocoapods/installer.rb:236:in `analyze'
/Users/karolgil/.rvm/gems/ruby-2.1.10/gems/cocoapods-1.2.1/lib/cocoapods/installer.rb:150:in `block in resolve_dependencies'
/Users/karolgil/.rvm/gems/ruby-2.1.10/gems/cocoapods-1.2.1/lib/cocoapods/user_interface.rb:64:in `section'
/Users/karolgil/.rvm/gems/ruby-2.1.10/gems/cocoapods-1.2.1/lib/cocoapods/installer.rb:149:in `resolve_dependencies'
/Users/karolgil/.rvm/gems/ruby-2.1.10/gems/cocoapods-1.2.1/lib/cocoapods/installer.rb:110:in `install!'
/Users/karolgil/.rvm/gems/ruby-2.1.10/gems/cocoapods-1.2.1/lib/cocoapods/command/install.rb:41:in `run'
/Users/karolgil/.rvm/gems/ruby-2.1.10/gems/claide-1.0.1/lib/claide/command.rb:334:in `run'
/Users/karolgil/.rvm/gems/ruby-2.1.10/gems/cocoapods-1.2.1/lib/cocoapods/command.rb:52:in `run'
/Users/karolgil/.rvm/gems/ruby-2.1.10/gems/cocoapods-1.2.1/bin/pod:55:in `<top (required)>'
/Users/karolgil/.rvm/gems/ruby-2.1.10/bin/pod:23:in `load'
/Users/karolgil/.rvm/gems/ruby-2.1.10/bin/pod:23:in `<main>'

【问题讨论】:

  • 你是在导入 EarlGrey.swift 吗?
  • 如何检查?我将其导入屏幕截图中,import EarlGrey 并且我不知道任何其他选项。
  • 您的语法是正确的。 select(elementWithMatcher:) 代码来自 EarlGrey.swift,它是在 EarlGrey 之上添加的 Swift 包装器,以实现更好的 API 兼容性。你能在你的资源中检查 EarlGrey.swift 是其中的一部分吗?
  • 您如何与 EarlGrey 集成?
  • @gran_profaci 我发现我的工作区实际上缺少 EarlGrey.swift。我将 CocoaPods (v 1.2.1) 和 EarlGrey (v 1.9.3) 与 XCode (v 8.3.2) 一起使用。然后在@khandpur 评论之后,我注意到我没有做gem install earlgrey,所以我这样做了。现在pod install 导致 RuntimeError - 请查看有关堆栈跟踪问题的更新。

标签: ios iphone swift earlgrey


【解决方案1】:

看起来你还没有添加 EarlGrey.swift,如果你安装了 earlgrey.gem 并使用 Pod 来管理你的项目,它应该会自动添加到你的测试目标中。还要确保您安装了最新的 earlgrey gem。

Carthage

或手动下载this file

【讨论】:

  • 我接受这个答案,因为问题实际上是缺少 EarlGrey.swift 文件。重新运行gem install earlgreypod install 后,测试确实成功运行了应用程序。
猜你喜欢
  • 2023-03-31
  • 1970-01-01
  • 1970-01-01
  • 2019-04-06
  • 1970-01-01
  • 2013-05-26
  • 2012-05-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多