doc/book/en/development/testing.rst
branchstable
changeset 5266 84f285d96363
parent 5255 15ea2f3464a4
equal deleted inserted replaced
5265:97ab2ea6d367 5266:84f285d96363
     1 .. -*- coding: utf-8 -*-
     1 .. -*- coding: utf-8 -*-
       
     2 
     2 Tests
     3 Tests
     3 =====
     4 =====
     4 
       
     5 .. toctree::
       
     6    :maxdepth: 1
       
     7 
     5 
     8 Unit tests
     6 Unit tests
     9 ----------
     7 ----------
    10 
     8 
    11 The *CubicWeb* framework provides the `CubicWebTC` test base class in
     9 The *CubicWeb* framework provides the `CubicWebTC` test base class in
    87 preventing cycles amongst Keyword entities.
    85 preventing cycles amongst Keyword entities.
    88 
    86 
    89 You can see an example of security tests in the
    87 You can see an example of security tests in the
    90 :ref:`adv_tuto_security`.
    88 :ref:`adv_tuto_security`.
    91 
    89 
    92 It is possible to have these tests run continuously using `apycot`
    90 It is possible to have these tests run continuously using `apycot`_.
    93 (http://www.logilab.org/project/apycot).
    91 
       
    92 .. _apycot: http://www.logilab.org/project/apycot
    94 
    93 
    95 Managing connections or users
    94 Managing connections or users
    96 +++++++++++++++++++++++++++++
    95 +++++++++++++++++++++++++++++
    97 
    96 
    98 Since unit tests are done with the SQLITE backend and this does not
    97 Since unit tests are done with the SQLITE backend and this does not
   218 ---------
   217 ---------
   219 
   218 
   220 Using Pytest
   219 Using Pytest
   221 ````````````
   220 ````````````
   222 
   221 
   223 `pytest` is an utility that extends the Python unittest functionality
   222 The `pytest` utility (shipping with `logilab-common`_, which is a
   224 and is the preferred way to run the CubicWeb test suites. Bare
   223 mandatory dependency of CubicWeb) extends the Python unittest
   225 unittests also work the usual way.
   224 functionality and is the preferred way to run the CubicWeb test
       
   225 suites. Bare unittests also work the usual way.
       
   226 
       
   227 .. _logilab-common: http://www.logilab.org/project/logilab-common
   226 
   228 
   227 To use it, you may:
   229 To use it, you may:
   228 
   230 
   229 * just launch `pytest` in your cube to execute all tests (it will
   231 * just launch `pytest` in your cube to execute all tests (it will
   230   discover them automatically)
   232   discover them automatically)
   252 
   254 
   253 CubicWebTC API
   255 CubicWebTC API
   254 ``````````````
   256 ``````````````
   255 .. autoclass:: cubicweb.devtools.testlib.CubicWebTC
   257 .. autoclass:: cubicweb.devtools.testlib.CubicWebTC
   256    :members:
   258    :members:
   257