3 ms·
Testing should also be the author's declaration to the world about what they believe should be happen and when. Good tests give you insight into the mind of the
by ericb 3y ago
Testing should also be the author's declaration to the world about what they believe should be happen and when. Good tests give you insight into the mind of the author at the time.
* When I add-to-cart, it should update the cart total
* When I add-to-cart, it should not decrease the available stock
* When I purchase, it should decrease the available stock
While these might be tests, they are also a form of live-code documentation about what the author intends. If you find later code that violates these expectations, you know that the old behaviors were intentional and you are updating expected behaviors that were not a side effect.