2015-11-19 71 views
2

當我運行一個簡單的葫蘆測試時,我總是碰到一個HTTPClient :: KeepAliveDisconnected異常。Calabash android - HTTPClient :: KeepAliveDisconnected

控制檯輸出:

Feature: Login 
    As a User i want to have access to my account 

    Scenario: right credentials   # features\login.feature:4 
1698 KB/s (567017 bytes in 0.326s) 
1596 KB/s (1481497 bytes in 0.906s) 
    Given I am at the login page  # features/step_definitions/login.rb:1 
    When I enter my username   # features/step_definitions/login.rb:5 
    And I enter my password   # features/step_definitions/login.rb:10 
    And I hit the Sign In button  # features/step_definitions/login.rb:15 
     **HTTPClient::KeepAliveDisconnected: Eine vorhandene Verbindung wurde vom Remotehost geschlossen. (HTTPClient::KeepAliveDisconnected)** 
     ./features/step_definitions/login.rb:16:in `/^I hit the Sign In button$/' 
     features\login.feature:8:in `And I hit the Sign In button' 
    Then I will see the Dashboard page # features/step_definitions/login.rb:19 

    Scenario: wrong credentials   # features\login.feature:11 
    Given I am at the login page  # features/step_definitions/login.rb:1 
    When I enter a wrong username  # features/step_definitions/login.rb:24 
    And I enter a wrong password  # features/step_definitions/login.rb:29 
    And I hit the Sign In button  # features/step_definitions/login.rb:15 
    Then I will stay at the login page # features/step_definitions/login.rb:34 

步驟定義:

Given(/^I am at the login page$/) do 
    query("* id:'email_sign_in_button'") 
end 

When(/^I enter my username$/) do 
    touch("* id:'email'") 
    query("* id:'email'",{:setText => "[email protected]"}) 
end 

When(/^I enter my password$/) do 
    touch("* id:'password'") 
    query("* id:'password'",{:setText => "admin"}) 
end 

When(/^I hit the Sign In button$/) do 
    touch("* id:'email_sign_in_button'") 
end 

Then(/^I will see the Dashboard page$/) do 
    query("* text:'Dashboard'") 
    sleep(3) 
end 

When(/^I enter a wrong username$/) do 
    touch("* id:'email'") 
    query("* id:'email'",{:setText => "ich bin cool"}) 
end 

When(/^I enter a wrong password$/) do 
    touch("* id:'password'") 
    query("* id:'password'",{:setText => "hululu"}) 
end 

Then(/^I will stay at the login page$/) do 
    query("* id:'email_sign_in_button'") 
    sleep(3) 
end 

我運行紅寶石V2.0.0

爲什麼步驟 「我打的登錄按鈕」 中失敗第一個場景但通過第二個場景?

回答

3

這可能意味着你的應用程序崩潰了。查看堆棧跟蹤的adb logcat。不建議使用query("* id:'email'",{:setText => "[email protected]"})。使用方法enter_text("* id:'email'", "[email protected]")