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-03-30 14:11:49 +0200
commitea6e7379a35e91f9ad064e5ad1e87c5177ea067b (patch)
tree1c5651a5deceea5443941c3ac30128a02f006ee3 /doc/reference/testing.rst
parent694f2d4b207739b8a095688782cebe59e73bb935 (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 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