Skip to content
This repository has been archived by the owner on May 25, 2022. It is now read-only.

Running Tests

xli edited this page Nov 3, 2014 · 11 revisions

Running Tests

  • Make sure Solr is running (it usually starts automatically when you boot Vagrant):

      rake sunspot:solr:start
    
  • Setup database and test environment:

      rake app:reset
    
  • Unit tests:

      bundle exec rake spec
    
  • Cucumber tests:

      # Run all cucumber tests
      bundle exec rake cucumber:all
    
      # Run headless tests
      bundle exec rake cucumber:headless
    
      # Run browser tests
      bundle exec rake cucumber:browser
    

Test Organization

Tests are split into:

  • RSpec - Unit Tests. Use these for testing all sorts of crazy combinations, all possible edge cases, and testing units of code (functions/methods)
    • Related gems: RSpec, FactoryGirl
    • Related folders: spec/
  • Cucumber - Use these for testing User Flows - end to end scenarios that touch upon multiple functionality. Don't use these for trivial tests, try using the Unit tests instead.
    • Cucumber Headless - These are tests that don't involve any Javascript, so they can be run with simple HTTP GET/POST (curl-style) requests, and can be verified by inspecting the response.
    • Cucumber Browser - These tests run Javascript (such as dropdowns, dialogs, etc), and thus need a running browser environment, in our case Firefox.
    • API Tests - These test the public JSON API
    • Related gems: Cucumber, Capybara, json_spec
    • Related folders: features/