File: patterns.rst

package info (click to toggle)
python-django-dynamic-fixture 4.0.1-1~bpo12%2B1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-backports
  • size: 616 kB
  • sloc: python: 3,909; makefile: 237; sh: 6
file content (46 lines) | stat: -rw-r--r-- 1,673 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
.. _patterns:

Patterns
*******************************************************************************

.. contents::
   :local:

Patterns
===============================================================================

  * Use *N* function for unit tests (not integration tests) for the main model.
  * Use *G* function instead of *N* for shelving configurations. It helps to identify errors.
  * Use *ignore_fields* option to deal with fields filled by listeners.
  * Use custom values for unsupported fields.
  * Use default lesson for unsupported fields with a custom function that generated data.
  * Use *fill_nullable_fields* for unsupported nullable fields.
  * Use *fk_min_depth* option to test trees.
  * [Automated Test Patterns](http://www.teses.usp.br/teses/disponiveis/45/45134/tde-02042012-120707/pt-br.php) (in Portuguese)

Anti-Patterns
===============================================================================

  * Using auto generated data in an assertion method.
  * Shelving a static value for a field with *unique=True*. Raise an error.
  * Overriding a lesson *Copier* with None.
  * Using *Copier* to fix a bad design of the code.
  * Too many named lessons configurations.
  * Mix data fixture algorithms in the same test suite.
  * Use default and custom lessons to avoid fixing a messy architecture.
  * Extensive use of global set up: setup suite (from DDF), setup module and setup class (from unittest2).


A good automated test
===============================================================================

  * Simple
  * Legible
  * Repeatable
  * Independent
  * Isolated
  * Useful
  * Unique
  * Accurate
  * Professional
  * Fast