https://noidea.dog/glue - A coworker shared this article and it is amazing to understand how much important glue work is for a project and what it means for a Senior Engineer to be that glue.
https://livebook.manning.com/book/the-art-of-unit-testing-third-edition/welcome/v-6/1
Powerful insights from Chapter 1 :
So, whatβs a βgoodβ unit test?
Unit tests should run quickly and be consistent in its results (it always returns the same result if you donβt change anything between runs).
- should have full control of the code under test.
- should be fully isolated (runs independently of other tests).
- should run in memory without requiring system files, networks, databases.
- should be as synchronous and linear as possible when it makes sense. (no parallel threads if we can help it)
Wait... Synchronous??? What about asyncs/awaits..
From a unit testing point of view, we should find a way to make the processes happening through a single path in a unit of work, from entry point to exit point, as synchronous as possible. That might mean triggering callbacks directly from the test, or it might mean faking the time in the test to the point where the test does not need to wait for any async code to finish executing, unless thereβs no other choice (at that point it might not be a unit test, but the situations can vary quite a bit).
Top comments (0)