why can I not see database records during a Unit Test (when I use a breakpoint)

Hi,

I’m getting into Unit Testing, however I’ve noted when I am using a breakpoint (with NetBeans IDE) half way through a unit test, although in the Unit Test it has already successfully created some rows, when I look directly in the database I can’t see them?

Q1 - Why is this?

Q2 - If this is normal, how can I fault find my unit test code itself? I’m assuming that the database gets cleaned up at the beginning and end of each test case so thats why I was wanted to see progress in the database during the unit test (via using breakpoints).

Regards

Greg

Hi,
I'm getting into Unit Testing, however I've noted when I am using a
breakpoint (with NetBeans IDE) half way through a unit test, although in the
Unit Test it has already successfully created some rows, when I look
directly in the database I can't see them?

Q1 - Why is this?
Q2 - If this is normal, how can I fault find my unit test code itself? I'm
assuming that the database gets cleaned up at the beginning and end of each
test case so thats why I was wanted to see progress in the database during
the unit test (via using breakpoints).

each test is run in a transaction (so that changes to the database
made by the test are rolled back). The default transaction isolation
level on most databases means that you cannot see the results of an
uncommitted transaction. You can change this, or just ruby code from
your breakpoint (eg if you want to look at account with id 25 just
look at Account.find(25))

Fred