Assertions should be as simple as possible

If the assertion is complex, the risk of introducing bugs in the assertion is higher. The more complex the assertion, the higher the risk. We will write the unit tests to ease our lives and not to have more code to debug.

Additionally, one test should assert only one thing. This one assertion may be coded with multiple Assert class methods, one after the other. Still, the aim of these is to assert the correctness of one single feature of the unit. Remember the SRP: one test, one feature. A good test is like a good sniper: one shot, one kill.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.135.249