Skip to content

Commit

Permalink
Docs for behave tests
Browse files Browse the repository at this point in the history
This commit adds an explaining comment to @flindenberg's PR #174. I also
forgot to add a few lines to the README about how to run the behave
tests. And I removed Chris' overly optimistic statement that we're using
TDD.
  • Loading branch information
maiksprenger committed Oct 9, 2015
1 parent 2fb834a commit 540a78a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,10 @@ If you just use "python manage.py create_dummy_data 5" without --flush it is NOT

### Running Tests

*Note*: we're committed to testing and hope, the next paragraph will not be a lie any longer soon :-)
Feature PR should be accompanied by appropriate test. We have unit and integration tests that
are run with `py.test`, and functional/behave tests that are run with `selenium`.

We are using test driven development (TDD) with [py.test](http://pytest.org/).

A good read on TDD is the free o'Reilly eBook ["Test-Driven Development with Python"](http://chimera.labs.oreilly.com/books/1234000000754/index.html)

To run the tests, run the following command (with your virtual env activated, see 3.)
To run unit tests, run the following command (with your virtual env activated, see 3.)

$ py.test -v [/path/to/volunteer_planner.git/]

Expand All @@ -184,6 +181,10 @@ This generates a nice HTML coverage page, to poke around which can be found at `

*Note*: The directory `htmlcov` is git-ignored.

To run selenium tests, run

$ behave tests/_behave

### Translations

We use [Transifex (tx)](https://www.transifex.com/coders4help/volunteer-planner/) for managing translations.
Expand Down
3 changes: 3 additions & 0 deletions tests/_behave/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ def before_all(context):
Steps to be executed before behave features are run.
Serves to fire up PhantomJS.
"""
# Our tests all test against the source strings (English), so we force PhantomJS to
# request pages in that language instead of the system's locale.
# http://stackoverflow.com/a/17862456
webdriver.DesiredCapabilities.PHANTOMJS['phantomjs.page.customHeaders.Accept-Language'] = 'en-US'
context.browser = webdriver.PhantomJS()

Expand Down

0 comments on commit 540a78a

Please sign in to comment.