James E. Blair | 9ab8662 | 2013-07-02 11:23:46 -0700 | [diff] [blame^] | 1 | =========================== |
| 2 | Testing Your OpenStack Code |
| 3 | =========================== |
| 4 | ------------ |
| 5 | A Quickstart |
| 6 | ------------ |
| 7 | |
| 8 | This is designed to be enough information for you to run your first tests. |
| 9 | Detailed information on testing can be found here: https://wiki.openstack.org/wiki/Testing |
| 10 | |
| 11 | *Install pip*:: |
| 12 | |
| 13 | [apt-get | yum] install python-pip |
| 14 | More information on pip here: http://www.pip-installer.org/en/latest/ |
| 15 | |
| 16 | *Use pip to install tox*:: |
| 17 | |
| 18 | pip install tox |
| 19 | |
| 20 | Run The Tests |
| 21 | ------------- |
| 22 | |
| 23 | *Navigate to the project's root directory and execute*:: |
| 24 | |
| 25 | tox |
| 26 | Note: completing this command may take a long time (depends on system resources) |
| 27 | also, you might not see any output until tox is complete. |
| 28 | |
| 29 | Information about tox can be found here: http://testrun.org/tox/latest/ |
| 30 | |
| 31 | |
| 32 | Run The Tests in One Environment |
| 33 | -------------------------------- |
| 34 | |
| 35 | Tox will run your entire test suite in the environments specified in the project tox.ini:: |
| 36 | |
| 37 | [tox] |
| 38 | |
| 39 | envlist = <list of available environments> |
| 40 | |
| 41 | To run the test suite in just one of the environments in envlist execute:: |
| 42 | |
| 43 | tox -e <env> |
| 44 | so for example, *run the test suite in py26*:: |
| 45 | |
| 46 | tox -e py26 |
| 47 | |
| 48 | Run One Test |
| 49 | ------------ |
| 50 | |
| 51 | To run individual tests with tox:: |
| 52 | |
| 53 | tox -e <env> -- path.to.module.Class.test |
| 54 | |
| 55 | For example, to *run the basic Zuul test*:: |
| 56 | |
| 57 | tox -e py27 -- tests.test_scheduler.TestScheduler.test_jobs_launched |
| 58 | |
| 59 | To *run one test in the foreground* (after previously having run tox |
| 60 | to set up the virtualenv):: |
| 61 | |
| 62 | .tox/py27/bin/python -m testtools.run tests.test_scheduler.TestScheduler.test_jobs_launched |
| 63 | |
| 64 | Need More Info? |
| 65 | --------------- |
| 66 | |
| 67 | More information about testr: https://wiki.openstack.org/wiki/Testr |
| 68 | |
| 69 | More information about nose: https://nose.readthedocs.org/en/latest/ |
| 70 | |
| 71 | |
| 72 | More information about testing OpenStack code can be found here: |
| 73 | https://wiki.openstack.org/wiki/Testing |