UTF-8(ArgumentError)calabash-cucumber中的无效字节序列

时间:2015-09-02 13:10:13

标签: ios cucumber calabash-ios

在遵循calabash-ios的快速通道设置指南而没有任何问题后,我尝试在项目文件夹中运行黄瓜时收到错误。我通过详细和回溯标志收到以下错误

Code:
  * features/support/env.rb
  * features/support/01_launch.rb
  * features/support/02_pre_stop_hooks.rb
  * features/step_definitions/calabash_steps.rb
  * features/step_definitions/my_first_steps.rb

Features:
  * features/my_first.feature
Parsing feature files took 0m0.003s

Feature: Running a test
  As an iOS developer
  I want to have a sample feature file
  So I can begin testing quickly

  Scenario: Example steps                            # features/my_first.feature:6
  invalid byte sequence in UTF-8 (ArgumentError)
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/run_loop-1.4.1/lib/run_loop/instruments.rb:162:in `split'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/run_loop-1.4.1/lib/run_loop/instruments.rb:162:in `block in pids_from_ps_output'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/run_loop-1.4.1/lib/run_loop/instruments.rb:161:in `map'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/run_loop-1.4.1/lib/run_loop/instruments.rb:161:in `pids_from_ps_output'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/run_loop-1.4.1/lib/run_loop/instruments.rb:15:in `instruments_pids'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/run_loop-1.4.1/lib/run_loop/instruments.rb:39:in `kill_instruments'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/run_loop-1.4.1/lib/run_loop/core.rb:178:in `run_with_options'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/run_loop-1.4.1/lib/run_loop.rb:82:in `run'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/calabash-cucumber-0.14.3/lib/calabash-cucumber/launcher.rb:755:in `block in new_run_loop'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/calabash-cucumber-0.14.3/lib/calabash-cucumber/launcher.rb:753:in `times'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/calabash-cucumber-0.14.3/lib/calabash-cucumber/launcher.rb:753:in `new_run_loop'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/calabash-cucumber-0.14.3/lib/calabash-cucumber/launcher.rb:631:in `relaunch'
  /Users/magnusm/Developer/Aubjorg-3.6_UITEST/Audbjorg/features/support/01_launch.rb:27:in `block in <top (required)>'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/core_ext/instance_exec.rb:48:in `instance_exec'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/core_ext/instance_exec.rb:48:in `block in cucumber_instance_exec'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/core_ext/instance_exec.rb:69:in `cucumber_run_with_backtrace_filtering'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/core_ext/instance_exec.rb:36:in `cucumber_instance_exec'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/rb_support/rb_hook.rb:14:in `invoke'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/language_support/language_methods.rb:114:in `invoke'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/language_support/language_methods.rb:102:in `block in execute_before'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/language_support/language_methods.rb:101:in `each'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/language_support/language_methods.rb:101:in `execute_before'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/language_support/language_methods.rb:15:in `before'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/runtime/support_code.rb:112:in `block in fire_hook'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/runtime/support_code.rb:111:in `each'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/runtime/support_code.rb:111:in `fire_hook'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/runtime.rb:107:in `before'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/runtime.rb:98:in `before_and_after'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/runtime.rb:82:in `block in with_hooks'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/runtime/support_code.rb:120:in `call'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/runtime/support_code.rb:120:in `block (3 levels) in around'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/language_support/language_methods.rb:9:in `block in around'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/language_support/language_methods.rb:97:in `call'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/language_support/language_methods.rb:97:in `execute_around'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/language_support/language_methods.rb:8:in `around'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/runtime/support_code.rb:119:in `block (2 levels) in around'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/runtime/support_code.rb:123:in `call'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/runtime/support_code.rb:123:in `around'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/runtime.rb:94:in `around'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/runtime.rb:81:in `with_hooks'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/tree_walker.rb:13:in `execute'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/scenario.rb:32:in `block in accept'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/scenario.rb:79:in `with_visitor'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/scenario.rb:31:in `accept'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/tree_walker.rb:58:in `block in visit_feature_element'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/tree_walker.rb:170:in `broadcast'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/tree_walker.rb:57:in `visit_feature_element'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/feature.rb:38:in `block in accept'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/feature.rb:37:in `each'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/feature.rb:37:in `accept'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/tree_walker.rb:27:in `block in visit_feature'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/tree_walker.rb:170:in `broadcast'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/tree_walker.rb:26:in `visit_feature'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/features.rb:28:in `block in accept'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/features.rb:17:in `each'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/features.rb:17:in `each'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/features.rb:27:in `accept'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/tree_walker.rb:21:in `block in visit_features'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/tree_walker.rb:170:in `broadcast'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/tree_walker.rb:20:in `visit_features'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/runtime.rb:49:in `run!'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/cli/main.rb:47:in `execute!'
  /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/bin/cucumber:13:in `<top (required)>'
  /usr/local/var/rbenv/versions/2.2.3/bin/cucumber:23:in `load'
  /usr/local/var/rbenv/versions/2.2.3/bin/cucumber:23:in `<main>'
    Given I am on the Welcome Screen                 # features/step_definitions/my_first_steps.rb:1
    Then I swipe left                                # calabash-cucumber-0.14.3/features/step_definitions/calabash_steps.rb:222
    And I wait until I don't see "Please swipe left" # calabash-cucumber-0.14.3/features/step_definitions/calabash_steps.rb:158
    And take picture                                 # calabash-cucumber-0.14.3/features/step_definitions/calabash_steps.rb:217

Failing Scenarios:
cucumber features/my_first.feature:6 # Scenario: Example steps

1 scenario (1 failed)
4 steps (4 skipped)
0m0.226s

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

UPDATE 已在运行循环开发中修复。

运行循环中存在错误。

"Dilbert’s MacBook Pro [<UDID>]"

$ perl -ane '{ if(m/[[:^ascii:]]/) { print  } }' devices.txt
Dilbert’s MacBook Pro [<UDID>]

该字符串中的撇号导致问题。它是UTF8字符而不是ASCII。

感谢Magnus Olafur帮助我跟踪此事。