Skip to content

Testing Requirements

sdc50 edited this page Aug 5, 2016 · 11 revisions

For pull requests to be approved they must meet the following testing requirements:

  • All existing tests must pass
  • Additional tests must be written to test any new code
  • The percent of test coverage (as measured by the coverage report) must increase (or at least not decrease)

Testing code exists in the tests directory and is organized into unit_tests and gui_tests.

Follow these steps to run tests:

  1. activate tethys Python environment
$ . /usr/lib/tethys/bin/activate
  1. use pip to install selenium and coverage
(tethys)$ pip install selenium coverage
  1. in settings.py change the tethys_default database user to tethys_super
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'tethys_default',
        'USER': 'tethys_super',
        'PASSWORD': 'pass',
        'HOST': '127.0.0.1',
        'PORT': '5435'
    }
}
  1. use the tethys command line tools to run the tests:
  • to run all tests:
(tethys)$ tethys test
  • to run just the unit tests:
(tethsy)$ tethys test -u
  • to run just the gui tests:
(tethys)$ tethys test -g
  • to output a coverage report to the console:
(tethys)$ tethys test -c
  • to output an HTML formatted coverage report:
(tethys)$ tethys tests -C

NOTE: I don't have instructions for setting up a headless browser in Ubuntu yet. Gui tests may not work without the proper browser configuration. Until I can provide instructions for setting up a standardized testing browser environment I recommend just running unit tests with coverage:

(tethys)$ tethys test -u -c