On Tue, Dec 8, 2009 at 5:51 PM, Clive Crous <[email protected]> wrote:
> 2009/12/8 Steve Tooke <[email protected]>:
>> I'm trying to ensure that each scenario is run within a transaction.
>
> I'm not really sure how you would go about doing this. But I have to
> ask you *why*

We want to roll the database back to a clean state between tests -
ensuring that they are isolated.

> Surely if you're forcing your tests to be within a transaction block
> you're altering the environment of the test itself, therefore your
> tests aren't going to accurately test real world usage since each
> scenario in the real world will *not* be within transaction blocks.

While its true that the environment will be different to production, I
think its acceptable. Providing the tests are running within the same
process then it should have no real affect and it allows you to
rollback to a database with a known state.

Its essentially the same idea used by rails for transactional
fixtures. I believe it to be a fairly common practice.

I could probably drop and recreate the tables before each scenario -
but we have some data which should be preloaded into the database and
is required for the tests to run.

Steve

-- 
/tooky

--

You received this message because you are subscribed to the Google Groups 
"sequel-talk" 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/sequel-talk?hl=en.


Reply via email to