mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 07:10:12 +01:00
Updated Testing (markdown)
parent
9d4146c2e2
commit
87bdd9a5ce
1 changed files with 11 additions and 36 deletions
47
Testing.md
47
Testing.md
|
|
@ -33,38 +33,36 @@ bin/rake test test/models/project_test.rb test_has_default_context
|
|||
|
||||
### Running the acceptance tests
|
||||
|
||||
Acceptance tests are written using Cucumber. For those features that require JavaScript/AJAX, Tracks uses Capybara and Selenium.
|
||||
Acceptance tests are written using Cucumber. For those features that require JavaScript/AJAX, Tracks uses Capybara and Selenium. Selenium, in turn, uses Firefox to run its tests.
|
||||
|
||||
To run all the features excluding the work-in-progress (wip) features, run
|
||||
To run the entire Cucumber test suite, from the root directory of the project, run
|
||||
```
|
||||
bin/cucumber
|
||||
```
|
||||
This will execute all features, including those using Selenium.
|
||||
|
||||
To run the features that are work in progress run these:
|
||||
```
|
||||
bin/rake cucumber:wip
|
||||
```
|
||||
|
||||
To run an individual test file, append the path to the file, as in
|
||||
```
|
||||
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
|
||||
To run a single test, include the path to the file and the test's starting line number, e.g.
|
||||
```
|
||||
bin/cucumber features/calendar.feature:45
|
||||
```
|
||||
|
||||
If you encounter problems running selenium tests, look at the _Problems with cucumber selenium tests_ section below.
|
||||
Incomplete features can be marked as work-in-progress using the `@wip` tag in the feature file. They will not be executed as part of the normal test runs. Instead they can be manually run with
|
||||
```
|
||||
bin/rake cucumber:wip
|
||||
```
|
||||
|
||||
### Running the tests headless
|
||||
## Running the tests headless
|
||||
|
||||
All tests will run on a headless setup except for the selenium tests. They will need a webbrowser which will need a running X-server.
|
||||
All tests will run on a headless setup except for the Selenium tests. They will need a web browser which will need a running X-server.
|
||||
|
||||
You can solve this by running a virtual framebuffer X server or by using the capybara-webkit driver.
|
||||
|
||||
#### Using webkit
|
||||
### Using webkit
|
||||
|
||||
Uncomment the capybara-webkit gem in the Gemfile and run bundle install. This will need the Qt development libraries on your system.
|
||||
|
||||
|
|
@ -74,7 +72,7 @@ Run the features using webkit:
|
|||
bundle exec rake cucumber JS_DRIVER=webkit
|
||||
```
|
||||
|
||||
#### Framebuffer
|
||||
### Framebuffer
|
||||
For the framebuffer in Fedora, you need to install the packages xorg-x11-server-Xvfb and xorg-x11-apps
|
||||
|
||||
```
|
||||
|
|
@ -85,31 +83,8 @@ DISPLAY=:99.0 bundle exec rake cucumber:selenium
|
|||
killall Xvfb
|
||||
```
|
||||
|
||||
### Running the old browser-based Selenium test suite
|
||||
|
||||
We are migrating from the selenium test suite in the browser to cucumber and selenium on webrat. To run the selenium scripts that are not yet migrated, the following still applies:
|
||||
|
||||
To run the suite simply run Tracks in the test environment:
|
||||
|
||||
```
|
||||
bundle exec script/server -e test
|
||||
```
|
||||
|
||||
in a separate command window, then run
|
||||
```
|
||||
bundle exec rake test:acceptance
|
||||
```
|
||||
and Firefox will pop up and run the suite. If this does not work, you can run the suite manually by launching the server in test mode with the command above, and navigating to
|
||||
|
||||
http://localhost:3000/selenium/ in your browser of choice.
|
||||
|
||||
### Problems with cucumber selenium tests
|
||||
|
||||
#### Tests doesn't start
|
||||
|
||||
Firefox 3.x is required to run the selenium tests properly. It's also recommended to use an English version, to avoid problems due to the locale.
|
||||
You can get an old version of firefox [here](http://www.mozilla.org/en-US/firefox/all-older.html).
|
||||
|
||||
#### Sqlite3 Lock exceptions
|
||||
|
||||
In the default settings sqlite locks the db immediately. This behavior can cause problems with the fast executing online tests. Add a timeout to the database.yml configuration file to avoid these errors.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue