From ae236d9f232a23538277e1700a6192751c889bf7 Mon Sep 17 00:00:00 2001 From: troymc Date: Sun, 18 Dec 2016 11:41:04 +0100 Subject: [PATCH] Moved dev-and-test/running-all-tests.md content to tests/README.md --- .../source/dev-and-test/running-all-tests.md | 35 +--------------- tests/README.md | 40 ++++++++++++++----- 2 files changed, 30 insertions(+), 45 deletions(-) diff --git a/docs/server/source/dev-and-test/running-all-tests.md b/docs/server/source/dev-and-test/running-all-tests.md index f8e48422..bc9d32a7 100644 --- a/docs/server/source/dev-and-test/running-all-tests.md +++ b/docs/server/source/dev-and-test/running-all-tests.md @@ -1,36 +1,3 @@ # Running All Tests -Once you've installed BigchainDB Server, you may want to run all the unit and integration tests. This section explains how. - -First of all, if you installed BigchainDB Server using `pip` (i.e. by getting the package from PyPI), then you didn't install the tests. **Before you can run all the tests, you must [install BigchainDB from source](setup-run-node.html#how-to-install-bigchaindb-from-source).** - -To run all the tests, first make sure you have RethinkDB running: - -```text -$ rethinkdb -``` - -then in another terminal, do: - -```text -$ python setup.py test -``` - -(Aside: How does the above command work? The documentation for [pytest-runner](https://pypi.python.org/pypi/pytest-runner) explains. We use [pytest](http://docs.pytest.org/en/latest/) to write all unit and integration tests.) - - -### Using docker-compose to Run the Tests - -You can also use `docker-compose` to run all the tests. - -Start `RethinkDB` in the background: - -```text -$ docker-compose up -d rdb -``` - -then run the tests using: - -```text -$ docker-compose run --rm bdb py.test -v -``` +All documentation about writing and running tests (unit and integration tests) was moved to [the file `bigchaindb/tests/README.md`](https://github.com/bigchaindb/bigchaindb/blob/master/tests/README.md). \ No newline at end of file diff --git a/tests/README.md b/tests/README.md index d68788bc..5521e7eb 100644 --- a/tests/README.md +++ b/tests/README.md @@ -18,7 +18,13 @@ We write unit and integration tests for our Python code using the [pytest](http: ## Running Tests -You can run all tests using: +### Running Tests Directly + +If you installed BigchainDB Server using `pip install bigchaindb`, then you didn't install the tests. Before you can run all the tests, you must install BigchainDB from source. The [`bigchaindb/CONTRIBUTING.md` file](../CONTRIBUTING.md) has instructions for how to do that. + +Next, make sure you have RethinkDB running in the background (e.g. using `rethinkdb --daemon`). + +Now you can run all tests using: ```text py.test -v ``` @@ -33,27 +39,39 @@ or: python setup.py test ``` -If you want to learn about all the things you can do with pytest, see [the pytest documentation](http://pytest.org/latest/). +How does `python setup.py test` work? The documentation for [pytest-runner](https://pypi.python.org/pypi/pytest-runner) explains. + +The `pytest` command has many options. If you want to learn about all the things you can do with pytest, see [the pytest documentation](http://pytest.org/latest/). We've also added a customization to pytest: + +`--database-backend`: Defines the backend to use for the tests. +It must be one of the backends available in the [server configuration](https://docs.bigchaindb.com/projects/server/en/latest/server-reference/configuration.html). -### Our pytest Customizations +### Running Tests with Docker Compose -Customizations we've added to pytest: +You can also use [Docker Compose](https://docs.docker.com/compose/) to run all the tests. -- `--database-backend`: Defines the backend to use for the tests. Must be one of the backends - available in the [server configuration](https://docs.bigchaindb.com/projects/server/en/latest/server-reference/configuration.html) +First, start `RethinkDB` in the background: + +```text +$ docker-compose up -d rdb +``` + +then run the tests using: + +```text +$ docker-compose run --rm bdb py.test -v +``` - - -## Automated testing of pull requests +## Automated Testing of All Pull Requests We use [Travis CI](https://travis-ci.com/), 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](.travis.yml): 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](https://codecov.io/) to get a rough estimate of our test coverage.) ### Tox -We use [tox](https://tox.readthedocs.io/en/latest/) 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. +We use [tox](https://tox.readthedocs.io/en/latest/) 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 Travis CI build. To run all the tox tests, use: ```text @@ -70,4 +88,4 @@ 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](tox.ini). \ No newline at end of file +where `{ENVLIST}` is one or more of the environments specified in the [tox.ini file](../tox.ini).