When using automation for testing we want to accomplish two objects, accept the obvious test case automation:

  1. Keep the setup working, so even if a setup to the test is not crucial, do not fail the whole suite.
  2. If a single test fails, it should clean up , and allow following test to succeed.

This is why the test setup, known as Before in ginkgo, may use the “Expect” and fail the suite if the main testing setup gets an un predicted response, but the tear-down , known as After should not. I write the tear-down known as “After” in Ginkgo in a way that it will clean up in the reverse order the setup build the setup, but will not fail if any of the steps did not succeed as expected.

Assume you set up in three steps, 1 ,2 then 3. And the setup fpr 3 fails. If tear-down tries to undo step 3 and fails, it should continue to try to undo step 2 and 1.