2009-06-08 8 views
4

セレンのテストはランダムに失敗するのが好きです。レールモード:例として、私は、このシナリオ他の人と一緒にキュウリ+セレンがランダムに失敗する

Scenario: I should be able to edit a user 
    Given I created a user with the login "[email protected]" 
    And I am viewing the user with login "[email protected]" 
    Then I should see "Edit this user" 
    When I click "Edit this user" 
    Then I should be editing the user with login "[email protected]" 
    When I press "Update" 
    Then I should be viewing the user with login "[email protected]" 
    And I should see "User was successfully updated." 

これ、基本的なwebratを使用して作業罰金を持っています。セレンでは、ライン

Then I should be editing the user with login "[email protected]" 

Then I should be viewing the user with login "[email protected]" 

がランダムに失敗し、その時々最初は失敗して、他の回秒は失敗します。手作業でウェブサイトを使用すると正しい動作が得られ、私が言ったように、webrat/railsモードは正常に動作します。

のRails 2.2.2 キュウリ0.3.7 セレン1.1.14(FF3で動作するように固定)

いくつかの余分な情報:

Scenario: I should be able to edit a user       # features/admin_priviledges.feature:26 
    Given I created a user with the login "[email protected]"  # features/step_definitions/global_steps.rb:18 
    And I am viewing the user with login "[email protected]"   # features/step_definitions/global_steps.rb:60 
    Then I should see "Edit this user"        # features/step_definitions/webrat_steps.rb:93 
    When I click "Edit this user"         # features/step_definitions/webrat_steps.rb:18 
    Then I should be editing the user with login "[email protected]" # features/step_definitions/global_steps.rb:66 
    expected: "https://stackoverflow.com/users/8/edit", 
     got: "https://stackoverflow.com/users/8" (using ==) 
    Diff: 
    @@ -1,2 +1,2 @@ 
    -/users/8/edit 
    +/users/8 
    (Spec::Expectations::ExpectationNotMetError) 
    features/admin_priviledges.feature:31:in `Then I should be editing the user with login "[email protected]"' 
    When I press "Update"           # features/step_definitions/webrat_steps.rb:14 
    Then I should be viewing the user with login "[email protected]" # features/step_definitions/global_steps.rb:66 
    And I should see "User was successfully updated." 

Then /^I should be (editing|viewing) the (\w+) with (\w+) "([^\"]*)"$/ do |action,model,field,value| 
    func = make_func(action,model) 
    m = find_model_by_field_and_value(model,field,value) 
    URI.parse(current_url).path.should == eval("#{func}(m)") 
end 

者は、関連するステップです。プレス "更新"は、標準的なwebratステップ(click_button)です

答えて

7

それが動作します。セレンが修正を待つように伝える!

2

リクエストのタイミングを見ましたか?私の腸は、セレンがあまりにも速く動いていると言います。

キュウリのステップとエラーメッセージと、失敗ごとのログの詳細を投稿できますか?

When /^I press "([^\"]*)"$/ do |button| 
    click_button(button) 
    selenium.wait_for_page_to_load 
end 

When /^I press "([^\"]*)"$/ do |button| 
    click_button(button) 
end 

からwebratステップを変更

+0

さらに詳しい情報を追加しました。私はWebrat.configureブロックからセレンの速度を設定できますか? –

+0

これに関する解決策はありますか?私は同じ問題を抱えているようです。 –

関連する問題