Add detailed unit test documentation for watcher

Change-Id: Ife4771707223351a84941b462d853c5e49ff55a5
This commit is contained in:
chenke 2018-11-05 10:48:33 +08:00
parent 59cae3268e
commit d6dc5675e3
1 changed files with 18 additions and 25 deletions

View File

@ -13,39 +13,32 @@ Testing
Unit tests Unit tests
========== ==========
All unit tests should be run using `tox`_. To run the same unit tests that are All unit tests should be run using `tox`_. Before running the unit tests, you
executing onto `Gerrit`_ which includes ``py35``, ``py27`` and ``pep8``, you should download the latest `watcher`_ from the github. To run the same unit
can issue the following command:: tests that are executing onto `Gerrit`_ which includes ``py35``, ``py27`` and
``pep8``, you can issue the following command::
$ workon watcher $ git clone https://git.openstack.org/openstack/watcher
(watcher) $ pip install tox $ cd watcher
(watcher) $ cd watcher $ pip install tox
(watcher) $ tox $ tox
If you want to only run one of the aforementioned, you can then issue one of If you only want to run one of the aforementioned, you can then issue one of
the following:: the following::
$ workon watcher $ tox -e py35
(watcher) $ tox -e py35 $ tox -e py27
(watcher) $ tox -e py27 $ tox -e pep8
(watcher) $ tox -e pep8
.. _tox: https://tox.readthedocs.org/ .. _tox: https://tox.readthedocs.org/
.. _watcher: https://git.openstack.org/cgit/openstack/watcher
.. _Gerrit: https://review.openstack.org/ .. _Gerrit: https://review.openstack.org/
You may pass options to the test programs using positional arguments. To run a If you only want to run specific unit test code and don't like to waste time
specific unit test, you can pass extra options to `os-testr`_ after putting waiting for all unit tests to execute, you can add parameters ``--`` followed
the ``--`` separator. So using the ``-r`` option followed by a regex string, by a regex string::
you can run the desired test::
$ workon watcher $ tox -e py27 -- watcher.tests.api
(watcher) $ tox -e py27 -- -r watcher.tests.api
.. _os-testr: https://docs.openstack.org/os-testr/latest
When you're done, deactivate the virtualenv::
$ deactivate
.. _tempest_tests: .. _tempest_tests:
@ -55,4 +48,4 @@ Tempest tests
Tempest tests for Watcher has been migrated to the external repo Tempest tests for Watcher has been migrated to the external repo
`watcher-tempest-plugin`_. `watcher-tempest-plugin`_.
.. _watcher-tempest-plugin: https://github.com/openstack/watcher-tempest-plugin .. _watcher-tempest-plugin: https://git.openstack.org/cgit/openstack/watcher-tempest-plugin