diff options
Diffstat (limited to 'doc/reference/testing.rst')
| -rw-r--r-- | doc/reference/testing.rst | 57 |
1 files changed, 56 insertions, 1 deletions
diff --git a/doc/reference/testing.rst b/doc/reference/testing.rst index 664540c5e0d..8eee2d39584 100644 --- a/doc/reference/testing.rst +++ b/doc/reference/testing.rst @@ -4,9 +4,20 @@ =============== -Testing Modules +Testing Odoo =============== +There are many ways to test an application. In Odoo, we have three kinds of +tests + +- python unit tests: useful for testing model business logic +- js unit tests: this is necessary to test the javascript code in isolation +- tours: this is a form of integration testing. The tours ensure that the + python and the javascript parts properly talk to each other. + +Testing Python code +=================== + Odoo provides support for testing modules using unittest. To write tests, simply define a ``tests`` sub-package in your module, it will @@ -90,3 +101,47 @@ As of Odoo 8, running tests outside of the install/update cycle is not supported. .. _unittest documentation: https://docs.python.org/2/library/unittest.html + +Testing JS code +=============== + +Qunit test suite +---------------- + +Odoo Web includes means to unit-test both the core code of +Odoo Web and your own javascript modules. On the javascript side, +unit-testing is based on QUnit_ with a number of helpers and +extensions for better integration with Odoo. + +To see what the runner looks like, find (or start) an Odoo server +with the web client enabled, and navigate to ``/web/tests`` +This will show the runner selector, which lists all modules with javascript +unit tests, and allows starting any of them (or all javascript tests in all +modules at once). + +.. image:: ./images/runner.png + :align: center + +Clicking any runner button will launch the corresponding tests in the +bundled QUnit_ runner: + +.. image:: ./images/tests.png + :align: center + +Writing a test case +------------------- + +This section will be updated as soon as possible. + +.. _qunit: http://qunitjs.com/ + + +Integration Testing +=================== + +Testing Python code and JS code separately is very useful, but it does not prove +that the web client and the server work together. In order to do that, we can +write another kind of test: tours. A tour is a mini scenario of some interesting +business flow. It explains a sequence of steps that should be followed. The +test runner will then create a phantom_js browser, point it to the proper url +and simulate the click and inputs, according to the scenario.
\ No newline at end of file |
