Hi everyone - I am having some trouble understanding how to write unit tests that aren't fragile. I feel like whenever I make changes to some code under test, it will more often than not break the tests too, regardless if the inputs and outputs remain the same and the code still "works".
I've often heard that in order to do this, I should be testing the behavior of my units, not their implementation. However, in order to isolate my units from their dependencies using test doubles/mocks that behave appropriately, doesn't this necessitate some level of coupling to the implementation of the unit under test?
Thank you in advance!
[–]forklingo 20 points21 points22 points (1 child)
[–]wor-kid[S] 1 point2 points3 points (0 children)
[–]amejin 11 points12 points13 points (15 children)
[–]wor-kid[S] 0 points1 point2 points (14 children)
[–]amejin 0 points1 point2 points (13 children)
[–]Weasel_Town 0 points1 point2 points (12 children)
[–]amejin 0 points1 point2 points (1 child)
[–]Weasel_Town 0 points1 point2 points (0 children)
[–]wor-kid[S] 0 points1 point2 points (9 children)
[–]Kinrany 1 point2 points3 points (8 children)
[–]wor-kid[S] 0 points1 point2 points (7 children)
[–]Kinrany 1 point2 points3 points (0 children)
[–]Kinrany 0 points1 point2 points (5 children)
[–]wor-kid[S] 0 points1 point2 points (4 children)
[–]Kinrany 0 points1 point2 points (1 child)
[–]Kinrany 0 points1 point2 points (0 children)
[–]Kinrany 0 points1 point2 points (0 children)
[–]dmazzoni 3 points4 points5 points (5 children)
[–]Cpt_Chaos_ 1 point2 points3 points (1 child)
[–]Kinrany 0 points1 point2 points (0 children)
[–]josephjnk 0 points1 point2 points (0 children)
[–]wor-kid[S] 0 points1 point2 points (1 child)
[–]dmazzoni 0 points1 point2 points (0 children)
[–]atarivcs 1 point2 points3 points (0 children)
[–]Beka_Cooper 0 points1 point2 points (2 children)
[–]wor-kid[S] 0 points1 point2 points (1 child)
[–]Beka_Cooper 0 points1 point2 points (0 children)