Mercurial > libervia-backend
diff doc/contribuing/testing.rst @ 3498:d78b5eae912a
tests: update following names change
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 16 Apr 2021 18:32:34 +0200 |
parents | b166a59b1724 |
children | 4705f80b6e23 |
line wrap: on
line diff
--- a/doc/contribuing/testing.rst Fri Apr 16 18:32:16 2021 +0200 +++ b/doc/contribuing/testing.rst Fri Apr 16 18:32:34 2021 +0200 @@ -61,14 +61,14 @@ ``--dev-mode`` Shortcut for ``--keep-containers``, ``--keep-profiles`` and ``--keep-vnc``. This is useful, as you guess with its names, for development of tests. User can then log-in into - the ``sat`` container, launch a Python console, and work with the automated browser in + the ``backend`` container, launch a Python console, and work with the automated browser in real-time. Basic commands to launch a browser and log-in with test account are printed at the end of the tests. Note that if you want to have profiles created, or extra tools like the fake SMTP server, you'll have to launch at least one test which require them. - To log-in into the ``sat`` container, you can use the following command, from + To log-in into the ``backend`` container, you can use the following command, from ``/docker`` directory:: - $ docker-compose -f docker-compose_e2e.yml exec sat /bin/bash + $ docker-compose -f docker-compose_e2e.yml exec backend /bin/bash Then run a python console with given instructions @@ -100,7 +100,7 @@ ``test_profiles`` Creates a bunch of test accounts which are available during the whole test session. Those account are destroyed once all the tests are finished (successful or not), except - if you set the ``SAT_TEST_E2E_KEEP_PROFILES`` environment variable (or use the + if you set the ``LIBERVIA_TEST_E2E_KEEP_PROFILES`` environment variable (or use the ``--keep-profiles`` flag in ``run_e2e.py``. The profiles created are in the form ``accountX`` for account on the ``server1.test``, @@ -127,7 +127,7 @@ and ``fake_file.get_dest_hash(dest_file_path)`` will generate its hash once written. ``sent_emails`` - When used, a fake SMTP server (already configured in container's ``sat.conf``) will be + When used, a fake SMTP server (already configured in container's ``libervia.conf``) will be launched if it's not already, and all messages sent to it since the beginning of the test will be available in the given list. Message are subclasses of ``email.message.EmailMessage`` with the extra properties ``from_``, ``to``, ``subject`` @@ -135,21 +135,21 @@ The SMTP server is terminated at the end of the test session. -jp e2e tests ------------- +libervia-cli e2e tests +---------------------- -End-to-end tests for ``jp`` are a good way to tests backend features without having to +End-to-end tests for ``libervia-cli`` are a good way to tests backend features without having to deal with frontends UI. Those tests use extensively the ``sh`` module, which helps -writing ``jp`` commands like if they where methods. +writing ``libervia-cli`` commands like if they where methods. Among the helping fixture (check the various ``conftest.py`` files for details), the following are specially good to know: -``jp_json`` - Set the ``json_raw`` output are parse it. When you use this instead of the normal ``jp``, +``li_json`` + Set the ``json_raw`` output are parse it. When you use this instead of the normal ``libervia-cli``, you'll get a Python object that you can manipulate easily. -``jp_elt`` +``li_elt`` Set the ``xml_raw`` output and parse it as a Twisted ``domish.Element``. When you use a command which can return XML, it is useful to get this object which is easy to manipulate in Python. @@ -161,7 +161,7 @@ method (this code is in a string which will be executed by Python interpreter, where the ``content`` variable is the received text). By default, the text is kept unmodified. - After ``editor`` has been used by the ``jp`` command, you can check its + After ``editor`` has been used by the ``libervia-cli`` command, you can check its ``original_content`` property to see the text that it received, and ``new_content`` property to see the text that has been written after updating the original content with the code set in ``set_filter``. @@ -198,14 +198,14 @@ Following examples have to be run from ``tests/e2e`` directory. -Run all tests for ``jp``:: +Run all tests for ``Libervia CLI``:: - $ ./run_e2e.py -k jp + $ ./run_e2e.py -k libervia-cli -Run all tests for ``Libervia`` with real-time visual feedback (note that you need to have +Run all tests for ``Libervia Web`` with real-time visual feedback (note that you need to have ``vncviewer`` installed and available in path, see above):: - $ ./run_e2e.py -k libervia --visual + $ ./run_e2e.py -k libervia-web --visual Run all tests with verbose mode (useful to know which test is currently running):: @@ -221,10 +221,10 @@ $ ./run_e2e.py -k user_can_create_account --dev-mode -…then to go into the ``sat`` container and work with the browser (to be run in ``docker`` +…then to go into the ``backend`` container and work with the browser (to be run in ``docker`` directory)…:: - $ docker-compose -f docker-compose_e2e.yml exec sat /bin/bash + $ docker-compose -f docker-compose_e2e.yml exec backend /bin/bash …and, inside the container, you can now run ``python3`` and enter instruction prints at the end of the test session.