I am having a Database using which we show reports that is group by applying count etc. I just need to have the best unit test framework in place which can help me out in querying the database automatically and verifying the result.
Asked
Active
Viewed 425 times
0

Brian Tompsett - 汤莱恩
- 5,753
- 72
- 57
- 129

Abhishek Parikh
- 171
- 1
- 6
- 22
-
There aren't multiple JUnit frameworks. JUnit is one unit testing framework. JUnit is not for database testing. Please clarify your question, it looks like you are confusing quite a lot of things. What do you want to test exactly? – Daniel Hilgarth Sep 11 '12 at 10:27
-
Do you have a Java DAO linked to your database? If so then you could write a series of JUnit tests to test you assertions about the data in the database. – John B Sep 11 '12 at 11:01
-
Thanks for correcting me Daniel I mean to Say Unit Testing Framework not Junit. I would like to test the data in the database is correct or not. – Abhishek Parikh Sep 11 '12 at 13:33
1 Answers
1
You can use DBUnit. It's a good framework for testing Database. You can use it along with JUnit, but since they are related to DB, they are often not considered Unit tests anymore. There are a lot of tutorials there.
Another thing is that if you use Spring Framework and Hibernate, you can wire your DAO and creating test cases without DBUnit. It may be beneficial if you are working with legacy database and have difficulties creating the data samples.

Hoàng Long
- 10,746
- 20
- 75
- 124