Set Up and Tear Down
Global Set Up and Tear Down
Section titled “Global Set Up and Tear Down”Test project folders may contain global set up and tear down functions. To indicate a global set up function, name it with the prefix Global_Set_Up_. Use the prefix Global_Tear_Down_ to indicate a global tear down function. Each of the global set up functions found in a test project folder will be executed once, in alphanumeric order by name, before all the test fixtures are executed, after which each of the global tear down functions will be executed once, again in alphanumeric order by name.
Global set up and tear down functions are only searched for in the root of a test project folder, not in sub-folders.
Global set up and tear down functions are executed in alphanumeric order, for the same reasons as fixture and test level set up and tear down functions.
Test fixtures within a test project folder are not guaranteed to run in any specific sequence. Test fixtures should also be written in such a way that they are independent of each other, similar to test cases.
Set Up and Tear Down Data
Section titled “Set Up and Tear Down Data”Any data created in global, fixture, or test level set up functions may be required in subsequent set up, tear down, and test case functions. To make such an item of data available from a set up function, add a result property for it to the set up function, with the name and type of your choice. Then, to consume such an item of data in a set up, tear down, or test case function, add a parameter to it with the same name and type as the result property created above. The test runner will pass all matching data along in the course of the test run.