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