(/touch-icon-144.png) (/touch-icon.png) (/touch-icon.png) (/touch-icon-144.png) (/touch-icon-144.png) (/opensearch.xml) (Lobsters) (/favicon.ico) (https://lobste.rs/s/gijhis/unit_testing_principles) Unit Testing Principles | Lobsters (/assets/application-2f99e16b.css) (/assets/system-system-bf6d5bb3.css) (/assets/tom-select-9d6bcb6b.css) (/assets/TomSelect_remove_button-4d5c34b9.css) (/) (Lobsters (Current traffic: 1%)) (/active) Active (/recent) Recent (/comments) Comments (/search) Search (/login) Login (/login) Login (/login) 13 (https://olano.dev/blog/unit-testing-principles/) Unit Testing Principles (/t/practices) (Development and team practices) practices (/t/testing) (Software testing) testing (/domains/olano.dev) olano.dev authored by (/~facundoolano) (facundoolano avatar) (/~facundoolano) facundoolano (2025-08-01 16:51:33 -0500) 27 hours ago | caches (https://web.archive.org/web/3/https%3A%2F%2Folano.dev%2Fblog%2Funit-testing-principles%2F) Archive.org (https://archive.today/https%3A%2F%2Folano.dev%2Fblog%2Funit-testing-principles%2F) Archive.today (https://ghostarchive.org/search?term=https%3A%2F%2Folano.dev%2Fblog%2Funit-testing-principles%2F) Ghostarchive | (/s/gijhis/unit_testing_principles#comments_story_01k1kswvpafqv90vcydfh1acpk) 2 comments (Vpfm-yN3ny25WBBfAXWoqycDPdiP3mUgrqCLOXTQCV7qOYfKW9tiHnllpjMazcrgensqQC-OXmDzm-aScT4gzQ) (gijhis) (post) (You must be logged in to leave a comment.) (Post) Preview (/login) 10 (/~matklad) (matklad avatar) (/~matklad) matklad edited (/c/prrpxf) (2025-08-02 03:14:11 -0500) 17 hours ago This is surprisingly reasonable despite using unit/integration dichotomy! Though, I continue to maintain that the most important insight about testing is that there are two independent axes here: how much IO is done by test (none > some FS access > some IPC > some HTTP to a different machine) which fraction of your codebase is exercised by the test (single function without dependencies > the entire thing) (https://testing.googleblog.com/2010/12/test-sizes.html?m=1) https://testing.googleblog.com/2010/12/test-sizes.html?m=1 There’s also third axes, whether we are testing a single unit of behavior, or a more complicated composite flow, but it is of the least consequences for writing tests. EDIT: worth pointing out how the article (and I presume the book) avoids the usual confusion: it re-defines the meaning of unit! It uses neither the original meaning (unit is the test itself , (https://web.archive.org/web/20150315073817/http://www.xprogramming.com/testfram.htm#:~:text=unit%20of%20testing) unit of testing , as a encoding of a defined part of a manual testing process in a repl), nor the acquired meaning (unit as a (https://en.wikipedia.org/wiki/Unit_testing) component or module ), and instead conveniently defines it as “unit of behavior”. There’s some deep truth in here about naming things! (/login) (/~facundoolano) (facundoolano avatar) (/~facundoolano) facundoolano (/c/stp6gm) (2025-08-02 19:15:13 -0500) 1 hour ago That definition of unit is one of my favorite take-aways from the book. The (https://www.youtube.com/watch?v=6sNmJtoKDCo) Clarity talk mentioned at the beginning does a great job of showing how to use it when testing a feature. (/about) About (/tags) Tags (/filters) Filter (/moderations) Moderation Log