Just few weeks earlier, I was showing ApprovalTests to a local friend and he felt very confused with the whole concept.
Confusion happens a lot. For me it was helpful to understand, over longer period of time that:
- The "right" level of comparison could be Asserts (hand-crafted checks) vs. Approvals (pushing results to file & recognizing / reviewing for correctness before approving as checks).
- You can make a golden master of just about anything you can represent in a file, not just text.
- The custom asserts are packaged clean-up extensions for types of objects that make verifying that type of object even more straightforward.
As they paired, the first thing they added was ApprovalTests for the current pages to keep them under control while restructuring. For the upcoming couple of hours, I just listened in to them stumbling on various types of unexpected problems that the tests caught, and moving fast to fix things and adjust whatever they were changing. I felt I was listening to the magic of "proper unit tests" that I so rarely get to see as part of my work.
Aki tweeted after the session:
If you go see the tweet I quoted, an exemplary confusion happens as a result of it.The more I have chance to work with @LlewellynFalco, the more I fell in love with ApprovalTests - this makes refactoring so fast and easy.— Aki Salmi (@rinkkasatiainen) August 17, 2016
- Someone states ApprovalTests are somehow special / good idea.
- Someone else asks why they are different from normal tests
- An example is given of how they are different
- The example is dismissed as something you wouldn't want to test anyway
I look at these discussions more on the positives of what happens to the programming work when these are around, and I see it again and again. In hands of Llewellyn Falco and anyone who pairs with him, ApprovalTests are magical. Finding a way of expressing that magic is a wonderful puzzle that often directs my thinking around testing ApprovalTests.