OK, I've heard option #1 a couple of times - I will have a look at that option since this seems to be a way quiet a few people have choosen.
#2 is not an real option; I have an existing schema and I have some sample data I would like to always be in the DB ... since that's like external, god-given data :) #3 ... hmm, in my current project I have to deal with Oralce (which is totally new for me, but thanks to NHibernate I don't really care about the DB at all). But because of that T-SQL is no real option. I would really love some "technique" I could use for all projects (always aim for the stars!) #4 that's what I had also in mind. But I would like some tool-support for that so that I don't really have to care which DB I'm currently using. I'm afraid backups will work differently in Oracle and MS- SQL ... #5 ... hmm - grumpf. On 5 Nov., 21:51, "Jeff Brown" <[EMAIL PROTECTED]> wrote: > This is a very hard problem in general. > > Here are a few different approaches: > > 1. Use [Rollback] in MbUnit to automatically rollback changes made to the Db > during a test. This assumes that the subject under test is enlisting its > transactions the usual way. > > 2. Drop & recreate the database schema. Not always an option. > > 3. Create a temporary snapshot of a baseline database for testing purposes. > (http://msdn.microsoft.com/en-us/library/ms175876.aspx) > > 4. Backup and restore the database from a known snapshot. This can work > quite well if the database is small. > > 5. Give up and write stateful and persistent integration tests. (last > resort) > > We could definitely use some better tooling in this area... > > Jeff. > > -----Original Message----- > From: [email protected] [mailto:[EMAIL PROTECTED] On > > Behalf Of Henning > Sent: Wednesday, November 05, 2008 11:38 AM > To: MbUnit.User > Subject: MbUnit Reseting Database to known state > > Hi, > > so after I created all my domain-entities and mappings (NHibernate) I would > like to test if the mapping to the actual relational database works as > expected. > > OK, so far no prob - just write a couple of unit-tests. But obviously I > should "reset" the db for each test, so that I always have a consistent and > known state. > > So how would I do that? The naive way would be to drop everything and have > the SchemaExporter of NH recreate everything. That's what I did so far - up > until now. Now I have an existing relational model which I must use, so I > can't just drop and recreate everything. > > Does anyone have a tip on how to achieve setting the db to a known state for > unit-testing? Ideally I would like to have some way which is actually usable > for various db-systems (currently I have to work with Oracle, but most of > the time I use MSSQL2005). > > I stumbled across a tool called "ndbunit" - but the site seems down :( > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "MbUnit.User" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/MbUnitUser?hl=en -~----------~----~----~----~------~----~------~--~---
