I am having some problems while trying to create integration tests with Selenium and NUnit.
I'm trying to use Selenium RC in NUnit test to drive my ASP.NET web app, and would like the tests to actually do all the stuff in DB that the real user would do. Naturally it would be nice if the database could get rolled back after Selenium has done it's thing, and i've asserted that db contains the new rows (etc) with the data from the ui.
So, here's the setup i have (in some sort of pseudocode):
TestMethod()
{
Using(new TransActionScope)
{
Selenium.StartSelenium()
Selenium.SelectAndClickAndDoStuffInUI()
AssertSomething()
}
}
Now, the SelectAndClickAndDoStuffInUI-method clicks around in UI and thus fires up our proprietary da-framework. Our framework writes all the stuff into db, and the AssertSomething-method asserts that everything is fine in db. Framework uses transactions ("required") in it's inner workings.
So everything is fine, right? No, sadly not. The TransActionScope in the example above shouldn't get committed (no txScope.Complete()-call there), and thus all the inner transactions should get rolled back too, right? Well they do not, and everything Selenium does through the UI gets committed to DB.
I've really tried to understand where this goes wrong, but so far haven't found the answer.
Thanks for reading, and (finally) here's the actual question:
Why the TransactionScope does not get rolled back in the case shown in my example?
I will gladly provide additional information about the situation and setup!