【问题标题】:xcode command line test with argument passed at launch带有参数的 xcode 命令行测试在启动时传递
【发布时间】:2015-07-14 14:53:02
【问题描述】:

我在 CI 实施 xcodebuild 命令测试时遇到了小问题。我有与特定设备语言相关的测试,在 xcode 中我可以将“启动时传递的参数”设置为 -AppleLanguages(语言)。我可以使用 xcodebuild 传递该参数吗?

我的脚本是这样的

xcodebuild -workspace MyApp.xcworkspace -scheme "MyAppTests" -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=9.0' test

谢谢!

【问题讨论】:

  • 它可能是通过环境变量设置的。运行 xcodebuild -workspace <ws> -target <t> -configuration <c> -showBuildSettings 并 grep 获取 -AppleLanguages。你得到任何合理的输出吗?
  • 您找到解决方案了吗?

标签: ios xcode continuous-integration xcodebuild


【解决方案1】:

xcodebuild 用于构建您的应用程序。您可以使用此命令以特定语言运行您的应用程序。

xcrun simctl launch <deviceid> <appid> -AppleLanguages "(pt-BR)"

这是一个示例,其中包含构建和运行您的应用的所有步骤:

xcodebuild -sdk iphonesimulator8.4 -arch i386 install DSTROOT=YourAppFolder
xcrun instruments -w "iPhone 6 (8.4 Simulator)"
xcrun simctl install booted YourAppFolder/Applications/YourApp.app
xcrun simctl launch booted com.yourdomain.yourapp -AppleLanguages "(pt-BR)"

【讨论】:

  • 它适用于构建和运行应用程序,但不适用于运行特定语言的 UI 测试。
猜你喜欢
  • 2015-05-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-07-16
  • 2021-11-25
  • 1970-01-01
  • 2015-12-10
相关资源
最近更新 更多