diff --git a/Testing.md b/Testing.md index ffae4d1..c053734 100644 --- a/Testing.md +++ b/Testing.md @@ -1,6 +1,6 @@ Testing Tracks is fairly simple. For its tests two different technologies are used: * [minitest](https://github.com/seattlerb/minitest) for unit, functional, and integration tests (in `/test`) -* [Cucumber](http://cukes.info/) for acceptance tests (in `/features`) +* [Cucumber](http://cukes.info/) with [Capybara](https://github.com/jnicklas/capybara) for acceptance tests (in `/features`) ## Setup @@ -8,7 +8,9 @@ Testing Tracks is fairly simple. For its tests two different technologies are us The tests make use of some gems which need to be installed first. If you have previously done a `bundle install --without development test` you will need to edit your `.bundle/config` and re-run `bundle install`. ### Database -(database instructions need to be added) +Ensure you have the `test` section properly configured in your `config/database.yml`. + +Since Rails 4.1, the test environment automatically loads the database schema, so you do not need to run the migrations. ## Running the tests @@ -31,14 +33,12 @@ bin/rake test test/models/project_test.rb test_has_default_context ### Running the acceptance tests -For integration testing Tracks uses cucumber. For those features that require javscript/ajax, Tracks uses Selenium and Capybara +Acceptance tests are written using Cucumber. For those features that require JavaScript/AJAX, Tracks uses Capybara and Selenium. To run all the features excluding the work-in-progress (wip) features, run - ``` -bin/rake cucumber RAILS_ENV=development +bin/cucumber ``` - This will execute all features, including those using Selenium. To run the features that are work in progress run these: @@ -46,9 +46,14 @@ To run the features that are work in progress run these: bin/rake cucumber:wip ``` -To run a feature by hand run these. +To run an individual test file, append the path to the file, as in ``` -bin/cucumber features/my_feature.feature +bin/cucumber features/calendar.feature +``` + +To run a single test, include the path to the file and the test's starting line number, as in +``` +bin/cucumber features/calendar.feature:45 ``` If you encounter problems running selenium tests, look at the _Problems with cucumber selenium tests_ section below.