Calabash Android:尝试在APK上运行测试时出现资产路径错误

时间:2014-03-04 02:00:34

标签: android runtime assets calabash

当我运行以下命令时,Calabash Android在我的Mac OS X上正常运行,然后非常突然且自发地...

  

calabash-android run

我收到以下错误:

    2014-03-03 17:48:38 - JDK found on PATH.
2014-03-03 17:48:38 - Android SDK found at: /Applications/AndroidStudio.app/sdk/
2014-03-03 17:48:38 - /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -S cucumber -v
Code:
  * features/support/env.rb
  * features/support/app_installation_hooks.rb
  * features/support/app_life_cycle_hooks.rb
  * features/support/hooks.rb
  * features/step_definitions/calabash_steps.rb

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

Feature: Login feature

  Scenario: As a valid user I can log into my app # features/my_first.feature:3
2014-03-03 17:48:38 - First scenario in feature - reinstalling apps
2014-03-03 17:48:38 - connected_devices: ["6b5140a7"]
2014-03-03 17:48:38 - "/Applications/AndroidStudio.app/sdk//platform-tools/adb" -s 6b5140a7 forward tcp:34777 tcp:7102
2014-03-03 17:48:38 -
W/asset   ( 4263): Asset path  is neither a directory nor file (type=1).
ERROR: dump failed because assets could not be loaded
  'package' not found in aapt output (RuntimeError)
  /Library/Ruby/Gems/2.0.0/gems/calabash-android-0.4.20/lib/calabash-android/helpers.rb:10:in `package_name'
  /Library/Ruby/Gems/2.0.0/gems/calabash-android-0.4.20/lib/calabash-android/operations.rb:72:in `uninstall_apps'
  /Users/Nauman/Desktop/APKs/features/support/app_installation_hooks.rb:22:in `Before'
W/asset   ( 4265): Asset path  is neither a directory nor file (type=1).
ERROR: dump failed because assets could not be loaded
  'package' not found in aapt output (RuntimeError)
  /Library/Ruby/Gems/2.0.0/gems/calabash-android-0.4.20/lib/calabash-android/helpers.rb:10:in `package_name'
  /Library/Ruby/Gems/2.0.0/gems/calabash-android-0.4.20/lib/calabash-android/operations.rb:448:in `wake_up'
  /Library/Ruby/Gems/2.0.0/gems/calabash-android-0.4.20/lib/calabash-android/operations.rb:477:in `start_test_server_in_background'
  /Library/Ruby/Gems/2.0.0/gems/calabash-android-0.4.20/lib/calabash-android/operations.rb:93:in `start_test_server_in_background'
  /Users/Nauman/Desktop/APKs/features/support/app_life_cycle_hooks.rb:5:in `Before'
    When I press "Login"                          # calabash-android-0.4.20/lib/calabash-android/steps/press_button_steps.rb:17
    Then I see "Welcome to coolest app ever"      # calabash-android-0.4.20/lib/calabash-android/steps/assert_steps.rb:5
2014-03-03 17:48:39 - java -jar /Library/Ruby/Gems/2.0.0/gems/calabash-android-0.4.20/lib/calabash-android/lib/screenshotTaker.jar 6b5140a7 screenshot_0.png
2014-03-03 17:48:40 - It looks like your app is no longer running.
It could be because of a crash or because your test script shut it down.
      HTTPClient::KeepAliveDisconnected (HTTPClient::KeepAliveDisconnected)
      /Library/Ruby/Gems/2.0.0/gems/httpclient-2.3.4.1/lib/httpclient/session.rb:882:in `block in parse_header'
      /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/timeout.rb:66:in `timeout'
      /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/timeout.rb:97:in `timeout'
      /Library/Ruby/Gems/2.0.0/gems/httpclient-2.3.4.1/lib/httpclient/session.rb:875:in `parse_header'
      /Library/Ruby/Gems/2.0.0/gems/httpclient-2.3.4.1/lib/httpclient/session.rb:858:in `read_header'
      /Library/Ruby/Gems/2.0.0/gems/httpclient-2.3.4.1/lib/httpclient/session.rb:667:in `get_header'
      /Library/Ruby/Gems/2.0.0/gems/httpclient-2.3.4.1/lib/httpclient.rb:1137:in `do_get_header'
      /Library/Ruby/Gems/2.0.0/gems/httpclient-2.3.4.1/lib/httpclient.rb:1086:in `do_get_block'
      /Library/Ruby/Gems/2.0.0/gems/httpclient-2.3.4.1/lib/httpclient.rb:887:in `block in do_request'
      /Library/Ruby/Gems/2.0.0/gems/httpclient-2.3.4.1/lib/httpclient.rb:986:in `rescue in protect_keep_alive_disconnected'
      /Library/Ruby/Gems/2.0.0/gems/httpclient-2.3.4.1/lib/httpclient.rb:980:in `protect_keep_alive_disconnected'
      /Library/Ruby/Gems/2.0.0/gems/httpclient-2.3.4.1/lib/httpclient.rb:886:in `do_request'
      /Library/Ruby/Gems/2.0.0/gems/httpclient-2.3.4.1/lib/httpclient.rb:774:in `request'
      /Library/Ruby/Gems/2.0.0/gems/httpclient-2.3.4.1/lib/httpclient.rb:684:in `post'
      /Library/Ruby/Gems/2.0.0/gems/calabash-android-0.4.20/lib/calabash-android/operations.rb:334:in `make_http_request'
      /Library/Ruby/Gems/2.0.0/gems/calabash-android-0.4.20/lib/calabash-android/operations.rb:290:in `http'
      /Library/Ruby/Gems/2.0.0/gems/calabash-android-0.4.20/lib/calabash-android/operations.rb:556:in `shutdown_test_server'
      /Library/Ruby/Gems/2.0.0/gems/calabash-android-0.4.20/lib/calabash-android/operations.rb:97:in `shutdown_test_server'
      /Users/Nauman/Desktop/APKs/features/support/app_life_cycle_hooks.rb:12:in `After'

Failing Scenarios:
cucumber features/my_first.feature:3 # Scenario: As a valid user I can log into my app

1 scenario (1 failed)
2 steps (2 skipped)
0m2.432s

我很感激任何帮助;我很难过,而且我的智慧结束了。

2 个答案:

答案 0 :(得分:1)

1。由于您的第一行错误是JDK found on PATH.

请安装JDK&在CMD中给出正确的路径。

2。您必须为calabash-android run path/to/apk.apk

提供APK的绝对路径

3。此外,请确保执行setupbuild& resign之前的run此命令。

创建正确的.keystore文件

calabash-android setup file.apk 

检测您的应用

calabash-android resign file.apk 

构建测试服务器

calabash-android build file.apk

答案 1 :(得分:0)

必须指定APK的路径才能导航到APK的路径。

应该运行的命令是calabash-android run /path/name.apk