Test-Driven Development By Example | George Aristy #60
Replies: 1 comment
-
Hi! Very interesting article, thanks! 🙏 I was particularly interested in the chapter about triangluation because I am using randomized values in my tests precisely to avoid triangulation, which seems a bit like a waste of time. What you explain is very interesting, because I prefered randomized values as I thought that using one or two or even three differents values do not "prove" that my system is robust. But your insight on the refactoring phase that should also avoid duplication between the test and the implementation is the key. That being said, I still find it a bit useless 😅 I mean: using this technique, one has to write multiple similar tests (at least 2), an implementation that will evolve, and then do a refactoring to all of this to remove all tests but one. With a randomized value, on the other hand, I directly have to adjust my implementation to the fact that the value is not known. I cannot use a simple constant to make the test pass. I do not have to write multiple tests that will be removed. I do not have to be rigorous enough to not forget to do this test-implementation de-duplication refactoring. And my test do express the correct need served by the implementation (i.e.: given "any" two numbers, I return the sum). You started your chapter saying that you would use randomization, so I understand that you explained the triangulation for the sake of pedagogy. But, over your experience and after reading this book, do you see any advantage of triangulation over the use of randomized values? Thanks again for this article, and your response! ;-) |
Beta Was this translation helpful? Give feedback.
-
Test-Driven Development By Example | George Aristy
Written by Kent Beck, Test-Driven Development By Example explains how TDD works by way of 2 examples: first building piece by piece a toy Money class, then the initial scaffolds of xUnit. The third and final part of the book walks the reader through several TDD patterns as well as refactoring patterns.
https://georgearisty.dev/posts/test-driven-development-by-example/
Beta Was this translation helpful? Give feedback.
All reactions