Cucumber performance improvements with Devise Token Authenticatable

September 1, 2010 Mike Barinek

We’re using Devise’s token_authenticatable to improve our Cucumber test suite performance.

Here’s an example feature


  Scenario: I would like to edit a user account
    Given I am logged in as an admin user
    ...

And here’s the token_authenticatable step


  Given /^(?:I am logged in|the user is logged in|the user logs in|I log in)(?: as an? (w+) user)?$/ do |role|
    if ENV['use_token']
      visit admin_dashboard_path(:token => @user.authentication_token)
    else
      Given("the user logs in with email: "#{@user.email}", password: "#{@password}"")
      ...
    end

We’ll then run cucumber using a “faster” profile


$ cucumber -p faster

And finally, here’s our cucumber.yml


faster: <%= std_opts %> features FASTER=true

Our cucumber tests run significantly faster after switching to the token_authenticatable approach.

About the Author

Biography

Previous
Working with asynchronously loaded javascript
Working with asynchronously loaded javascript

My pair and I were recently working on an app that asynchronously loaded the Facebook Javascript SDK but sy...

Next
Reindexing Solr from Cucumber
Reindexing Solr from Cucumber

Here's a quick snippet that we're using to reindex Solr from our Cucumber features. "And I reindex assets"...

SpringOne Platform 2019 Presentations

Watch Now