nFor
a collection of tests for a particular class, there are often some repeated tasks that must be
done prior to each
test case.
nExamples: create
some “interesting” objects to work with, open a network connection, etc.
nLikewise,
at the end of each test case, there may be repeated tasks to clean up after test
execution.
nEnsures resources are released, test system is in known state for next test case, etc.
nSince a test case failure ends execution of a test method at that point, code to clean up cannot be at the end of the method.