Loading ...
Sorry, an error occurred while loading the content.

Re: [junit] database relations

Expand Messages
  • J. B. Rainsberger
    ... Each test needs its own data to be isolated, so the obvious solution is to do this for each test: insertTestData runTest removeTestData After a while, you
    Message 1 of 2 , May 1, 2004
    View Source
    • 0 Attachment
      Mikler wrote:
      > HI!
      >
      > I've used search :)
      >
      > Here is a point.
      > Let say I need to do 2 tests;
      > In test1 i insert some data into clients table. And in test2 I need
      > to insert data into accounts table using Id that i've recieved in
      > test1.
      >
      > And it is on the beginning. There will be tests that need about 6
      > other test's results...
      >
      > What am I supposed to do?

      Each test needs its own data to be isolated, so the obvious solution is
      to do this for each test:

      insertTestData
      runTest
      removeTestData

      After a while, you notice that that makes the tests quite slow, which is
      likely where you are now.

      Google "unit testing databases" and look for an article by Richard
      Dallaway, then read it. After that, if you have more specific questions,
      come back and ask them.

      Good luck.
      --
      J. B. Rainsberger,
      Diaspar Software Services
      http://www.diasparsoftware.com :: +1 416 791-8603
      Let's write software that people understand
    Your message has been successfully submitted and would be delivered to recipients shortly.