..
2016-12-15 17:17:18 +01:00
2016-12-16 18:43:21 +01:00
2016-02-10 19:55:33 +01:00
2016-02-23 09:39:56 +01:00

BigchainDB Server Tests

The bigchaindb/tests/ Folder

The bigchaindb/tests/ folder is where all the tests for BigchainDB Server live. Most of them are unit tests. Integration tests are in the bigchaindb/tests/integration/ folder.

A few notes:

Writing Tests

We write unit and integration tests for our Python code using the pytest framework. You can use the tests in the bigchaindb/tests/ folder as templates or examples.

Running Tests

You can run all tests using:

py.test -v

or, if that doesn't work, try:

python -m pytest -v

or:

python setup.py test

If you want to learn about all the things you can do with pytest, see the pytest documentation.

Our pytest Customizations

Customizations we've added to pytest:

  • --database-backend: Defines the backend to use for the tests. Must be one of the backends available in the server configuration

Automated testing of pull requests

We use Travis CI, so that whenever someone creates a new BigchainDB pull request on GitHub, Travis CI gets the new code and does a bunch of stuff. You can find out what we tell Travis CI to do in the .travis.yml file: it tells Travis CI how to install BigchainDB, how to run all the tests, and what to do "after success" (e.g. run codecov). (We use Codecov to get a rough estimate of our test coverage.)

Tox

We use tox to run multiple suites of tests against multiple environments during automated testing. Generally you don't need to run this yourself, but it might be useful when troubleshooting a failing CI build.

To run all the tox tests, use:

tox

or:

python -m tox

To run only a few environments, use the -e flag:

tox -e {ENVLIST}

where {ENVLIST} is one or more of the environments specified in the tox.ini file.