java - Database unit testing (MySQL) -


I am trying to find a way to test my MySQL dependent code. I know how I would like to work it, but can not find the solution that works for me. I have seen in the DebianUnit, but it appears (if I am not mistaken) that it will require a running database and only the unit of things helps with the test side. I would like some way to avoid running a MySQL database during testing, what would be a good job of Microsoft Spoof drivers, which actually stores data in memory rather than need to access a real continuous database.

In my code it is a hard code to use a MySQL database. I can not inject some fake objects just like the way I would like to work on it is that when my code is called:

  DriverManager.getConnection ("jdbc: mysql: //" + + ": + + + + + + +" + "+" + "database, user name, password);  

It actually becomes a few other local databases that can be configured either through Maven or set-up of the Maven Test. I have seen in memory based databases such as HSQLDB, but there is no way to cheat MySQL driver.

Is there any device I'm looking for? Do you have a good way to test MySQL dependent code?

I have several projects in which I had to test integration against a running MySql server Every time you run your test, instead of setting it every time, I've developed it.

With this, you get a test database that works like a real thing (because it is) without setting it up.

DBUnit is also a good option if you want to duplicate database integration (as far as I know, no real MySql server is required DBUnate).


Comments