barbican/doc/source/testing.rst
John Vrbanac 2bfd7047bd Adding docs around running tests and devstack
Change-Id: I28bff3a87111966532e9e3c130c2a4c51a4eb06a
2014-10-30 15:12:24 +00:00

2.2 KiB

Writing and Running Barbican Tests

As a part of every code review that is submitted to the Barbican project there are a number of gating jobs which aid in the prevention of regression issues within Barbican. As a result, a Barbican developer should be familiar with running Barbican tests locally.

For your convenience we provide the ability to run all tests through the tox utility. If you are unfamiliar with tox please see refer to the tox documentation for assistance.

Unit Tests

Currently, we provide tox environments for Python 2.6 and 2.7. By default all available test environments within the tox configuration will execute when calling tox. If you want to run them independently, you can do so with the following commands

# Executes tests on Python 2.6
tox -e py26

# Executes tests on Python 2.7
tox -e py27

Note

If you do not have the appropriate Python versions available, consider setting up PyEnv to install multiple versions of Python. See the documentation regarding /setup/dev for more information.

Functional Tests

Unlike running unit tests, the functional tests require Barbican and Keystone services to be running in order to execute. For more information on setting up a Barbican development environment </setup/dev> and using Keystone with Barbican </setup/keystone>, see our accompanying project documentation.

Once you have the appropriate services running and configured you can execute the functional tests through tox.

# Execute Barbican Functional Tests
tox -e functional

By default, the functional tox job will use nosetests to execute the functional tests. This is primarily due to nose being a very well known and common workflow among developers. It is important to note that the gating job will actually use testr instead of nosetests. If you discover issues while running your tests in the gate, then consider running testr or Devstack</setup/devstack> to more closely replicate the gating environment.