Test Setup and Teardown
Have you ever worked on a project where you needed to prepare your work area first? Once ready, you can finally do some work. Then, after a while, you need to clean up your area. Maybe you use the area for other things and can’t just leave your project sitting around or it would get in the way.
Sometimes, tests can be a lot like that. They might not take up table space, but sometimes they can require an environment setup or some other results to be ready before they can run. Maybe a test makes sure that some data can be deleted. It makes sense that the data should exist first. Should the test be responsible for creating the data that it is trying to delete? It would be better to wrap up the data creation inside its own function. But what if you need to test several different ways to delete the data? Should each test create the data? They could call the same setup function.
If multiple tests need to perform similar preparation and cleanup work, not...