2016-04-25 46 views
4

我是Calabash测试的新手,在尝试制作多语言应用程序时遇到障碍。 这是我的测试场景: - 我选择一个文本框。 - 输入一种语言的字符串,然后用另一种语言输入一些文本。葫芦 - iOS模拟器无法选择键盘语言

这里出现障碍:当我尝试通过测试切换语言 - 它失败。我的意思是应用程序试图找到下一种语言的符号,并无休止地循环,因为当前的键盘布局不包含它。

我发现的唯一解决方案是手动切换布局,但这不是真正的测试选项。

我该如何解决?

回答

0

有两个步骤:

  1. 葫芦使用命令行工具来改变模拟器的语言和区域设置。
  2. 使用参数启动应用程序以设置首选语言和区域设置。

完全可以参考这个葫芦iOS版的维基页面上找到:Change Locale and Language

# Set the simulator language to Swiss German and locale to Swiss French 
$ calabash-ios sim locale de-CH fr_CH 

# In your Before hook, tell Calabash to launch the app in the locale and language. 
options = { 

# Launch with Swiss German as the primary language and Swiss French as the locale. 
:args => ["-AppleLanguages", "(de-CH)", 
      "-AppleLocale", "fr_CH"] 

} 

launcher.relaunch(options)