« LeSS - Tests unitaires » : différence entre les versions
De Wiki Agile
| Ligne 113 : | Ligne 113 : | ||
=== Arranger, Agir, Auditer (''Arrange'', ''Act'', ''Assert'') === | === Arranger, Agir, Auditer (''Arrange'', ''Act'', ''Assert'') === | ||
Un bon schéma à suivre en ce qui concerne les tests unitaires est "'''AAA'''" : '''Arrange (dans le sens de mettre en place)''', '''Act (dans le sens d’une action faite sur quelque chose)''' et '''Assert (dans le sens de contrôler)''' | |||
Un bon schéma à suivre en ce qui concerne les tests unitaires est | |||
If you can easily find this pattern in each of your test cases, your tests should be easy to understand, and they should be fairly specific and to the point. One unit test case should test only one thing. Therefore, there should be only one set of AAA in one test case. A test case shouldn’t be very long (longer than 10 lines of code) if it follows the AAA pattern. | If you can easily find this pattern in each of your test cases, your tests should be easy to understand, and they should be fairly specific and to the point. One unit test case should test only one thing. Therefore, there should be only one set of AAA in one test case. A test case shouldn’t be very long (longer than 10 lines of code) if it follows the AAA pattern. | ||