blob: 56f2fbb5e3d3ebdfe59980902e29364770d3d707 [file] [log] [blame]
James E. Blair9ab86622013-07-02 11:23:46 -07001===========================
2Testing Your OpenStack Code
3===========================
4------------
5A Quickstart
6------------
7
8This is designed to be enough information for you to run your first tests.
9Detailed 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
14More information on pip here: http://www.pip-installer.org/en/latest/
15
16*Use pip to install tox*::
17
18 pip install tox
19
20Run The Tests
21-------------
22
23*Navigate to the project's root directory and execute*::
24
25 tox
26Note: completing this command may take a long time (depends on system resources)
27also, you might not see any output until tox is complete.
28
29Information about tox can be found here: http://testrun.org/tox/latest/
30
31
32Run The Tests in One Environment
33--------------------------------
34
35Tox 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
41To run the test suite in just one of the environments in envlist execute::
42
43 tox -e <env>
44so for example, *run the test suite in py26*::
45
46 tox -e py26
47
48Run One Test
49------------
50
51To run individual tests with tox::
52
53 tox -e <env> -- path.to.module.Class.test
54
55For example, to *run the basic Zuul test*::
56
57 tox -e py27 -- tests.test_scheduler.TestScheduler.test_jobs_launched
58
59To *run one test in the foreground* (after previously having run tox
60to set up the virtualenv)::
61
62 .tox/py27/bin/python -m testtools.run tests.test_scheduler.TestScheduler.test_jobs_launched
63
James E. Blairdda6c912013-07-29 14:12:12 -070064List Failing Tests
65------------------
66
67 .tox/py27/bin/activate
68 testr failing --list
69
James E. Blair6c358e72013-07-29 17:06:47 -070070Hanging Tests
71-------------
72
73The following will run each test in turn and print the name of the
74test as it is run::
75
76 . .tox/py27/bin/activate
77 testr run --subunit | subunit2pyunit
78
79You can compare the output of that to::
80
81 python -m testtools.run discover --list
82
James E. Blair9ab86622013-07-02 11:23:46 -070083Need More Info?
84---------------
85
86More information about testr: https://wiki.openstack.org/wiki/Testr
87
88More information about nose: https://nose.readthedocs.org/en/latest/
89
90
91More information about testing OpenStack code can be found here:
92https://wiki.openstack.org/wiki/Testing