Enhancing test setup and teardown for multiple tests
Now that we have the ability to set things up for a test and cleanup after a test, we can do things such as preparing temporary data in the setup that a test needs in order to run and then removing the temporary data in the teardown after a test has run. If there are many different tests using data like this, they can each create similar data.
But what if we need to set up something for a whole group of tests, and then tear it down after all the tests finish? I’m talking about something that remains in place across multiple tests. For the temporary data, maybe we need to prepare a place to hold the data. If the data is stored inside a database, this would be a good time to open the database and make sure the necessary tables are ready to hold the data that each test will be creating. Even the connection to the database itself can remain open and used by the tests. And once all the data tests are done, then the teardown...