71 | | ** easing refactoring (changes can be more rapidly verified not to create new bugs), |
72 | | ** promoting refactoring (dividing units into testable pieces also creates more reusable pieces), |
73 | | ** standing in for specification documents (i.e. describing by example what the code needs to do). |
| 71 | * easing refactoring (changes can be more rapidly verified not to create new bugs), |
| 72 | * promoting refactoring (dividing units into testable pieces also creates more reusable pieces), |
| 73 | * standing in for specification documents (i.e. describing by example what the code needs to do). |
117 | | One unittest.TestCase per unit (procedure, method or function). This makes test output easy to follow as it is what unittest expects. I.e. don't test several units in one TestCase. |
118 | | You can just use asserts instead of the cumbersome test.assertEquals etc. methods which often don't do what you need. nose can introspect the stack to make meaningful messages. |
119 | | Avoid inheritance trees with unittests as the unittest.TestCase isn't really designed for inheritance, more as a convenient place to put the tests. |
120 | | Break test methods up into smaller methods. Non-test code can be extracted out into external procedures/functions which are easier to reuse. |
121 | | Read the nose documentation regarding writing tests: [http://readthedocs.org/docs/nose/en/latest/writing_tests.html] |
122 | | Read this too: [http://ivory.idyll.org/articles/nose-intro.html] |
| 117 | * One unittest.TestCase per unit (procedure, method or function). This makes test output easy to follow as it is what unittest expects. I.e. don't test several units in one TestCase. |
| 118 | * You can just use asserts instead of the cumbersome test.assertEquals etc. methods which often don't do what you need. nose can introspect the stack to make meaningful messages. |
| 119 | * Avoid inheritance trees with unittests as the unittest.TestCase isn't really designed for inheritance, more as a convenient place to put the tests. |
| 120 | * Break test methods up into smaller methods. Non-test code can be extracted out into external procedures/functions which are easier to reuse. |
| 121 | * Read the nose documentation regarding writing tests: [http://readthedocs.org/docs/nose/en/latest/writing_tests.html] |
| 122 | * Read this too: [http://ivory.idyll.org/articles/nose-intro.html] |