doc/book/en/development/testing/index.rst
branchtls-sprint
changeset 1714 a721966779be
child 2172 cf8f9180e63e
equal deleted inserted replaced
1499:fd8751c3f3ee 1714:a721966779be
       
     1 .. -*- coding: utf-8 -*-
       
     2 
       
     3 Tests
       
     4 =====
       
     5 
       
     6 .. toctree::
       
     7    :maxdepth: 1
       
     8 
       
     9 
       
    10 Unit tests
       
    11 ----------
       
    12 
       
    13 `CubicWeb` framework provides essentially two Python test classes in the
       
    14 module `cubicweb.devtools.apptest`:
       
    15 
       
    16 * `EnvBasedTC`, to simulate a complete environment (web + repository)
       
    17 * `RepositoryBasedTC`, to simulate a repository environment only
       
    18 
       
    19 Thos two classes almost have the same interface and offers numerous methods to
       
    20 write tests rapidely and efficiently.
       
    21 
       
    22 XXX FILLME describe API
       
    23 
       
    24 In most of the cases, you will inherit `EnvBasedTC` to write Unittest or
       
    25 functional tests for your entities, views, hooks, etc...
       
    26 
       
    27 
       
    28 Email notifications tests
       
    29 -------------------------
       
    30 When running tests potentially generated e-mails are not really
       
    31 sent but is found in the list `MAILBOX` of module `cubicweb.devtools.apptest`. 
       
    32 This list is reset at each test *setUp* (by the setUp of classes `EnvBasedTC`
       
    33 and `RepositoryBasedTC`).
       
    34 
       
    35 	
       
    36 You can test your notifications by analyzing the contents of this list, which
       
    37 contains objects with two attributes:
       
    38 * `recipients`, the list of recipients
       
    39 * `msg`, object email.Message
       
    40 
       
    41 
       
    42 Automatic testing
       
    43 -----------------
       
    44 XXXFILLME