Mercurial > libervia-backend
comparison doc/contribuing/testing.rst @ 3439:b166a59b1724
tests, doc(testing): added `pytest-dependency` plugin to `backend_e2e` image + doc
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 04 Dec 2020 12:37:38 +0100 |
parents | 5d7569378914 |
children | d78b5eae912a |
comparison
equal
deleted
inserted
replaced
3438:84fb41b515a1 | 3439:b166a59b1724 |
---|---|
38 The arguments set to this script are the ``pytest`` options, thus you can have a verbose | 38 The arguments set to this script are the ``pytest`` options, thus you can have a verbose |
39 mode with ``-v`` and select specific test with ``-k EXPRESSION`` (see ``pytest --help`` for | 39 mode with ``-v`` and select specific test with ``-k EXPRESSION`` (see ``pytest --help`` for |
40 details). | 40 details). |
41 | 41 |
42 In addition to pytest option, some flags can be set with the following arguments: | 42 In addition to pytest option, some flags can be set with the following arguments: |
43 | |
44 | 43 |
45 ``--visual`` | 44 ``--visual`` |
46 Launch a VNC viewer to see in real time browser based tests. You must have ``vncviewer`` | 45 Launch a VNC viewer to see in real time browser based tests. You must have ``vncviewer`` |
47 executable available in your path (this is part of `TigerVNC`_) | 46 executable available in your path (this is part of `TigerVNC`_) |
48 | 47 |
71 | 70 |
72 $ docker-compose -f docker-compose_e2e.yml exec sat /bin/bash | 71 $ docker-compose -f docker-compose_e2e.yml exec sat /bin/bash |
73 | 72 |
74 Then run a python console with given instructions | 73 Then run a python console with given instructions |
75 | 74 |
75 It's also good to know that in the e2e test environment, the following pytest plugins are | |
76 installed and used: | |
77 | |
78 `pytest-timeout`_ | |
79 To avoid having test stuck, it's good to terminate them after a while. A timeout of 60s | |
80 is set by default for each test (lower value can give false negatives, as some e2e tests | |
81 can be long, notably with Selenium). | |
82 | |
83 `pytest-dependency`_ | |
84 Even if good testing practice normally means that tests can be run independently, in the | |
85 case of e2e tests we are using a real environment, and some tests do create files, | |
86 PubSub nodes, accounts, etc. It would be resource consuming to delete then recreate them | |
87 only to have standalone tests, thus to keep tests short and simple, some of them must be | |
88 run in order. The *dependecy* plugin is used to manage that, and will skip tests if one | |
89 of their dependencies is failing. The markup help also to document the tests order. | |
90 | |
76 .. _TigerVNC: https://tigervnc.org | 91 .. _TigerVNC: https://tigervnc.org |
92 .. _pytest-timeout: https://github.com/pytest-dev/pytest-timeout | |
93 .. _pytest-dependency: https://github.com/RKrahl/pytest-dependency | |
77 | 94 |
78 common fixtures | 95 common fixtures |
79 --------------- | 96 --------------- |
80 | 97 |
81 Here are the fixture common to all e2e tests which are good to know: | 98 Here are the fixture common to all e2e tests which are good to know: |