mercredi 29 juillet 2015

MinitTest Testcase fails when I run complete suite, succeeds when I run it alone

I am deeply confused about my tests and one testcase specifically:

When I run all of my integration tests together this specific testcase gives me this error: UsersSignupCapybaraTest test_signup_process_with_capybara ERROR (5.16s) Capybara::ElementNotFound: Unable to find link or button "Sign up now!"

When running just this one test it passes: UsersSignupCapybaraTest test_signup_process_with_capybara PASS (10.19s)

Can someone explain this to me? I asked a similar question yesterday here. I think I am not understanding some basic mechanism of my tests. Am I wrong, assuming that each testcase is tested isolated? Or does one start, where there previous stopped? That wouldn't make sense as I would have to take care of the order they get executed, which sounds not right to me.

Here is the file containing the testcase:

require 'test_helper' class UsersSignupCapybaraTest < ActionDispatch::IntegrationTest def setup Capybara.register_driver :selenium_chrome do |app| Capybara::Selenium::Driver.new(app, :browser => :chrome) end Capybara.current_driver = :selenium_chrome end test "signup process with capybara" do visit root_path click_on "Sign up now!" fill_in "user_name", with: "Neuer User" fill_in "user_email", with: "neuer@user.de" # more code ... end end

Aucun commentaire:

Enregistrer un commentaire