summaryrefslogtreecommitdiff
path: root/doc/reference/testing.rst
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2018-02-09 15:47:43 +0100
committerGéry Debongnie <ged@odoo.com>2018-04-05 09:22:09 +0200
commit19946294fad8edcb046cc79d5c2b94c405db6840 (patch)
tree9b7371561869d19c031289b34b9775ccfa84590b /doc/reference/testing.rst
parent438006b56d66175923c3795c666f07245358ade3 (diff)
[DOC] doc: update/add documentation on js framework
The state of the JS documentation was quite sad, not updated in a long time. With this commit, we rework a lot of the JS doc. Most notably, we add a section 'Javascript Cheatsheet' (help on some common customization tasks) and rewrite the 'Javascript Reference' totally. Note that the JS reference page also contains a reference on all field widgets. This work is just the beginning, it is probably not complete, but at least we will have a foundation.
Diffstat (limited to 'doc/reference/testing.rst')
-rw-r--r--doc/reference/testing.rst57
1 files changed, 56 insertions, 1 deletions
diff --git a/doc/reference/testing.rst b/doc/reference/testing.rst
index ada14166202..e25e8d31433 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
@@ -99,3 +110,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