I have inherited a test project with thousands of test methods / classes and I need to implement a new clean up procedure that needs to run after or before every test. I know this is not the best but this is the current situation I am in. In a year from now we will hopefully have all these tests rebuilt properly. I need to some how run a method before or after every test without hard codding the method in every single test class as we just do not have time for this. I know there are attributes for assembly clean up and init, but that only runs before and after the entire assembly. I need something like this, but that runs after every test without coding that functionality per test.
Is this possible? What are some options?
EDIT I am using MSTest
Assuming you're using MSTest, the attribute you need for the set up method is [TestInitialize]. A method decorated with this attribute will run before every single test.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With