Does NUnit support the concept of an Assembly Teardown similar to the Microsoft.VisualStudio.TestTools.UnitTesting.AssemblyCleanupAttribute that can be applied to a static method?
This would be run after all the tests within the assembly have completed. I am currently using NUnit 2.6.0.
It turns out this functionality does exist in NUnit it is just not very obvious or intuitive.
According to Charlie Poole in the feature request I made for this functionality here, he states the following will work, which is a direct quote from him.
Decorate a class outside of any namespace with [SetUpFixture]. Decorate a method of that class with [TearDown]. If you like, decorate another with [SetUp].
Differences from what you are asking for:
The name makes it a little unobvious in this usage.
NUnit allows any number of these and calls them all, without any guarantee of ordering. This is by design.
It can be applied to a static or instance method. If it's an instance method, the class must have a default constructor and it will be created with a lifespan of the entire test run. This is also by design.
Now this is not pretty but it should achieve the same functionality, and maybe he will make it a little cleaner in 3.0. :)
There is no such concept in NUnit. But you can apply TestFixtureTearDownAttribute
to method to free resources obtained by TestFixture.
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