« LeSS - Tests unitaires » : différence entre les versions

De Wiki Agile
Aucun résumé des modifications
Aucun résumé des modifications
Ligne 41 : Ligne 41 :
[[File:https://less.works/img/technical-excellence/xunit_test.png.pagespeed.ic.U9rHA2rtat.webp]]
[[File:https://less.works/img/technical-excellence/xunit_test.png.pagespeed.ic.U9rHA2rtat.webp]]


[[Image:Xunit_test_fr.png|Xunit_test_fr.png]]
[[Image:Xunit_test_fr.png|Xunit_test_fr.png|border|link=]]


The purpose for unit testing is rather protect what we have implemented than to find any defects, just like the anchors set by a rock climber along his way up the rock. These anchors help him to protect what he has achieved.
The purpose for unit testing is rather protect what we have implemented than to find any defects, just like the anchors set by a rock climber along his way up the rock. These anchors help him to protect what he has achieved.
Ligne 119 : Ligne 119 :
[[File:https://less.works/img/technical-excellence/xtest_levels.png.pagespeed.ic.-xbOy_tP-P.png]]
[[File:https://less.works/img/technical-excellence/xtest_levels.png.pagespeed.ic.-xbOy_tP-P.png]]


[[Image:Xtest_levels_fr.png|Xtest_levels_fr.png]]
[[Image:Xtest_levels_fr.png|Xtest_levels_fr.png|border|link=]]


A reasonable automated test structure should be like a pyramid. At the bottom are a lot of unit test cases. In the middle are much fewer integration level test cases. On the top, there are even fewer functional/system level tests.
A reasonable automated test structure should be like a pyramid. At the bottom are a lot of unit test cases. In the middle are much fewer integration level test cases. On the top, there are even fewer functional/system level tests.
Ligne 175 : Ligne 175 :
[[File:https://less.works/img/technical-excellence/xunit_test.png.pagespeed.ic.U9rHA2rtat.webp]]
[[File:https://less.works/img/technical-excellence/xunit_test.png.pagespeed.ic.U9rHA2rtat.webp]]


[[Image:Xunit_test_fr.png|Xunit_test_fr.png]]
[[Image:Xunit_test_fr.png|Xunit_test_fr.png|border|link=]]


== Good Unit Test Patterns ==
== Good Unit Test Patterns ==
Ligne 191 : Ligne 191 :
[[File:https://less.works/img/technical-excellence/500xNxunit_test_success.png.pagespeed.ic.W3mg1FIwIC.png]]
[[File:https://less.works/img/technical-excellence/500xNxunit_test_success.png.pagespeed.ic.W3mg1FIwIC.png]]


[[Image:unit_test_success.png|unit_test_success.png]]
[[Image:unit_test_success.png|unit_test_success.png|border|link=]]


Rule of thumb:
Rule of thumb:
Ligne 204 : Ligne 204 :
[[File:https://less.works/img/technical-excellence/342xNxunit_test_fail.png.pagespeed.ic.eM-9actgRz.png]]
[[File:https://less.works/img/technical-excellence/342xNxunit_test_fail.png.pagespeed.ic.eM-9actgRz.png]]


[[Image:342xNxunit_test_fail.png|342xNxunit_test_fail.png]]
[[Image:342xNxunit_test_fail.png|342xNxunit_test_fail.png|border|link=]]


Et lorsqu’un test unitaire échoue, il devrait nous fournir toutes les informations nécessaires. L’objectif est de limiter la durée pendant laquelle vous êtes occupés à débogguer le code concerné.
Et lorsqu’un test unitaire échoue, il devrait nous fournir toutes les informations nécessaires. L’objectif est de limiter la durée pendant laquelle vous êtes occupés à débogguer le code concerné.