Dougui
Dougui

Reputation: 7230

Integration test without cucumber?

I'm creating an application with Rspec and Cucumber. My application use a lot of Javascript and Ajax and it works but... I have always many problems with Cucumber and Javascript. In addition, it's very slow. For each launch, it start firefox and for each scenario it must login my site. I think than I could use mock with rspec for the login part(???).

Do you think than it's better to use Cucumber rather than RSpec/Capybara (and maybe Steak)? Is it faster to forget cucumber? How are you doing you're acceptances tests?

Upvotes: 1

Views: 209

Answers (2)

yetanothersullivan
yetanothersullivan

Reputation: 156

My company uses rspec/cucumber as well. If the speed of selenium is a bottle neck you could try something like capybara-webkit

Not sure if it helps, but we also use a login macro that only hits the login page during javascript requests

def login_user
  let(:current_user) { Factory.create(:user) }

  before(:each) do
    if example.options[:js]
      visit new_user_session_path
      fill_in 'Email', :with => current_user.email
      fill_in 'Password', :with => current_user.password
      click_button 'Sign In'
    else
      page.driver.post user_session_path, 'user[email]' => current_user.email, 'user[password]' => current_user.password
    end
  end
end

Upvotes: 3

Bassam Mehanni
Bassam Mehanni

Reputation: 14944

At my company we replaced Cucumber with Rspec+Capybara it's faster and more concise in my opinion. All the code for your test is in one place for the most part which makes it easier for debugging too.

Upvotes: 1

Related Questions