I have a base class that has a TestInitialize
and a TestCleanup
in it. I then have other test classes which inherit from this class. The TestCleanup
is supposed to perform certain actions when a test from the derived class fails.
The TestCleanup
gets executed when the test fails in the actual test. However, when the test fails in the TestInitialize
, the TestCleanup
doesn't even get executed. Why does this happen and is there a way to get the TestCleanup
to get called anyway?
I don't think that the fact that the TestInitialize
and TestCleanup
are in a base class is at all causing this issue, I just wanted to give more information just in case it was.
This is a known issue. It looks like it has been reported to Microsoft connect.
http://connect.microsoft.com/VisualStudio/feedback/details/694337/testcleanup-method-does-not-run-when-it-should
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