I want to use the role back feature yet when I write the tag it seems to not exists.
I am using nunit 2.5.0
I just used the nunit.framework.dll
Do I need to add some other .dll in?
Also does anyone know how I actually get nunit to connect to a sql sever database in an asp.net application?
I am not sure where to put my connection string.
I think you need to use XTUnit or NUnitX, not plain NUnit.
Old thread, but I thought I'd share for future reference.
As far as I can tell, there isn't a native [Rollback]
attribute. However, you can write your own pretty easily:
This blog post shows how to write a custom rollback attribute for NUnit, so that you can write
[Test, Rollback]
at the beginning of each test (or at the beginning of the TestFixture if you prefer).
It's fairly straightforward, and it uses System.Transaction.TransactionScope()
to do the meat of it.
Of course, you can always just use TransactionScope() in your SetUp/TearDown to accomplish the same thing, see the accepted answer to this question.
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