Greg Hauptmann
2008-Jun-15 21:37 UTC
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Jun-16 07:54 UTC
Re: why can I not see database records during a Unit Test (when I use a breakpoint)
On Jun 15, 10:37 pm, "Greg Hauptmann" <greg.hauptmann.r...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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> > Regards > Greg--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---