Now that I think about it the clean up was a bad example of a use case for a callback on an assert considering you could clean up on an tear down or with the action attribute. However, the case I ran into recently was I needed to log when an assert failed using our frameworks logger.
Now without a callback on an assert the only way I could perform work when a specific assert failed was to use a try/catch where I was able to try the assert, do my logging in the catch if it failed, and throw it back afterwards. I think it would be much nicer to allow the user to specify a callback instead of performing a try/catch so it can still be a nice one liner and keep the test case clean. -- You received this bug notification because you are a member of NUnit Developers, which is subscribed to NUnit V2. https://bugs.launchpad.net/bugs/1178412 Title: Add callback support to Asserts Status in NUnit V2 Test Framework: New Bug description: This feature is to allow you to add a callback method when you assert, that would run right before the test fails. This would allow you to perform your own logging when an assert fails, clean up anything the test did (such as a database connection), etc. To manage notifications about this bug go to: https://bugs.launchpad.net/nunitv2/+bug/1178412/+subscriptions _______________________________________________ Mailing list: https://launchpad.net/~nunit-core Post to : nunit-core@lists.launchpad.net Unsubscribe : https://launchpad.net/~nunit-core More help : https://help.launchpad.net/ListHelp