How Can Hierarchical Test Structure Absolutely Make a Mess?
▻https://hackernoon.com/how-can-hierarchical-test-structure-absolutely-make-a-mess-f72f47b5bf57?
source: pexelsHave you ever written your unit tests using a simple xUnit style #testing framework?Then you probably know, as tests get more complex, the more boilerplate and duplication they collect, either spread among the test methods, or setup functions.Now, hierarchical context frameworks are pretty robust to mitigate this boilerplate problem and remove this duplication. They allow you to have nested contexts each one having their own little bit of setup, and “inheriting” the setup of parent contexts.This way, you can express lots of different scenarios without actually repeating yourself even once in the test setup code.Great, isn’t it?Now, what if I told you that hierarchical test structure can cause more subtle duplication (that it was supposed to prevent in the first place) that is (...)