Does MSpec have a “global” cleanup capability?
-
24-02-2021 - |
Question
I am using MSpec to drive my browser tests, but I keep forgetting to close the browser. Rather than put this cleanup in every context, can it be applied globally?
Solution
A quote from the author in the only article I could find on the subject...
You can implement a
ICleanupAfterEveryContextInAssembly
to perform cleanup after every context (think cleaning up static state, resetting your ServerClock/DateTime replacement for example.
OTHER TIPS
You can inherit specifications. Cleanup defined in the base specification class is invoked after all child cleanups.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow