@@ -1722,6 +1722,60 @@ source: [Smoke testing (software), Wikipedia](https://en.wikipedia.org/wiki/Smok
17221722:::::::::
17231723::::::::::::
17241724
1725+ # summary
1726+
1727+ :::::::::::: {.columns}
1728+ ::::::::: {.column width="50%" .text-smaller}
1729+ ![ ] ( figures/v_model_unit_testing.drawio.svg ) {width=450}
1730+
1731+ unit is defined as a single behaviour exhibited by the system under test
1732+
1733+ :::::::::
1734+ ::::::::: {.column width="50%"}
1735+ ![ ] ( figures/test_pyramid.drawio.svg ) {width=450}
1736+ :::::::::
1737+ ::::::::::::
1738+
1739+ - a unit test is another piece of code, that tests the given unit
1740+ - arrange, act, assert(, annihilate)
1741+ - the percentage of the code lines ‘protected’ or covered by tests
1742+ - test the edge cases
1743+
1744+
1745+ ## test-driven development (TDD)
1746+
1747+ :::::::::::: {.columns}
1748+ ::::::::: {.column width="50%"}
1749+ ![ ] ( figures/tdd.drawio.svg ) {width=350}
1750+
1751+ :::::::::
1752+ ::::::::: {.column width="50%" .mt-5}
1753+ ![ "As the tests get more specific, the code gets more generic." -- Robert C. Martin] ( figures/test_code_generality.drawio.svg ) {width=375 .mt-4}
1754+
1755+ :::::::::
1756+ ::::::::::::
1757+
1758+ ## the legacy code dilemma
1759+
1760+ legacy code: code without tests
1761+
1762+ ::: {.quote-wide}
1763+ > When we change code, we should have tests in place.
1764+ > To put tests in place, we often have to change code.
1765+
1766+ :::
1767+
1768+
1769+ | | add feature | fix a bug | refactor | optimize |
1770+ | ---------------- | ----------- | --------- | -------- | -------- |
1771+ | structure | changes | changes | changes | |
1772+ | new funcionality | changes | | | |
1773+ | functionality | | changes | | |
1774+ | resource usage | | | | changes |
1775+
1776+ ::: {.text-smaller}
1777+ source: Michael Feathers, Working Effectively with Legacy Code [ @feathers2004working ]
1778+ :::
17251779
17261780# references
17271781
0 commit comments