Published in clarityai-engineering·Feb 12Deciphering test feedbackYou may find many statements on the Internet: “tests give you valuable design feedback”, “listen to the test feedback”, and so on. But you seldom find a “test feedback manual” telling you what is actually test feedback and how to react to it. This post gives you a concrete example…Testing6 min read
Published in clarityai-engineering·Sep 24, 2021Sociable or solitary unit tests — choose your tradeoffsWhat to choose as a unit for a test? Should it focus on a single module (whatever it is in your programming language) and its narrow responsibilities, or, maybe on a group of collaborating modules? Should my test be sociable and include System Under Test (SUT) dependencies, the dependencies of…Testing5 min read
Aug 10, 2021Clean TestsAll my articles about effective and efficient testing listed in reverse chronological order: Deciphering test feedback Sociable or solitary unit tests — choose your tradeoffs Don’t break the contract chain Effective test doubles, part 1 and part 2 What is the System Under Test? A tale from Gallic Wars Good vs bad test helpers Painless assertions Minimal Fixture everywhereTesting1 min readClean TestsPhoto by Jacob Sapp on UnsplashAll my articles about effective and efficient testing listed in reverse chronological order:Deciphering test feedbackSociable or solitary unit tests — choose your tradeoffsDon’t break the contract chainEffective test doubles, part 1 and part 2What is the System Under Test? A tale from Gallic WarsGood vs bad test helpersPainless assertionsMinimal Fixture everywhere----
Mar 26, 2021Don’t break the contract chainIn my previous article about the effective usage of test doubles, I described how mocks and stubs can be introduced to define contracts between internal components of a closed system (e.g. a microservice). …Cdc10 min read
Feb 12, 2021Modularize your code with folding and monoidsIn this article, I’ll show you how to apply functional programming techniques to achieve greater abstraction and flexibility in your code. We’ll refactor together a rigid code towards a more generic solution by introducing folding (or reduce), higher-order functions, and combining values in an abstract way (with a fancy name…Refactoring8 min read
Nov 28, 2020Effective test doubles, part 2This is the second (and the last) part of my longer article about applying effectively test doubles. In part 1 I presented tips on tactical mock/stub usage. I assumed that you were already using mock objects, I gave hints about how to squeeze the most out of them and avoid…Testing13 min read
Nov 11, 2020Effective test doubles, part 1Twenty years ago, Endo-Testing: Unit Testing with Mock Objects, the first paper on mock objects was published. Its authors described the usage of real object replacements to improve both the production and the test code. They named Mock Objects them after Mock Turtle, a creature from Alice in Wonderland that…Testing8 min read
Oct 31, 2020What is the System Under Test? A tale from Gallic WarsSeptember, 52 BC, Alesia, Gaul Julius Caesar was waging wars in Gaul for six long years. He thought he had conquered Gallia for the glory of Rome, but in 52 BC a young, ambitious, and charismatic chieftain, Vercingetorix, managed to unify the Gallic tribes and revolted against Romans. Caesar pursued Vercingetorix and his fellow soldiers…Testing7 min read
Oct 20, 2020Good vs bad test helpersThis time I’ll talk about the use and abuse of test helper methods. But first, let’s start (again) with a short description of why we are writing tests and what is a test for? A test sends stimuli to the test subject and examines the response. In a more plain…Testing9 min read
Oct 13, 2020Painless assertionsA good test provides evidence of how the System Under Test (SUT) transforms inputs into outputs. We set up a test fixture, execute the SUT, and finally, we verify the results (structure known as Setup-Execute-Verify or Arrange-Act-Assert). …Testing6 min read