At 11:35 AM -0500 1/5/05, Charles N. Harvey III wrote:
Hello.
I have been doing lots of reading about how great it is to use an in-process
DB like Hypersonic for testing.  Thing is, there are not many examples of
how to do this.  What I want to do is start an in-memory DB (not a file DB
because the test is small) when I run my tests, and then run tests.

So the first thing that has to happen when I run "maven test" is that the
DB has to be created.  Then I have to execute CREATE statements for the
necessary tables.  Then I can proceed with my tests.

Has anyone done this?  Should I use a file-based DB instead of in memory?
How do I get the maven test suite to "do this one thing first, and only
once"?

You can put a "preGoal" or postGoal element in maven.xml alongside your project.xml.


<preGoal name="test:test">
... Jelly or Ant magic here ...
</preGoal>

It can take some monkeying around to figure out the goal that happens at the right point.

I don't have any experience with in-memory DBs, so I'm not entirely sure how you'd make it available to the tests even after doing this. I suppose the JUnit-ish way would be to just do it in the setup method of your tests, but presumably you're trying to minimize overhead? Although, how do you ensure the DB is in a consistent state unless you do it for each test run, which means doing it in setup() ?

Joe

--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "Narrow minds are weapons made for mass destruction" -The Ex


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to