0

I am quite new to Java and JUnit. We have loads of procedures in the database which we want to test, so we were thinking of the possibility of using JUnit to test them if it is feasible.

The database procs/functions which need to be tested along with the parameters, output expected will all be passed through a file. I am not sure whether this is something where JUnit would help as we are looking at getting the information from the file, run the tests for each proc and then provide an output which specifies how many had failed along with the error messages.

Based on my understanding when I read few posts and internet search, it seems that I need a separate method with @Test to test every database procedure which would mean that we need to create Java methods in advance. But the test would be to help database developers who don't have much knowledge in Java, to just specify the proc to be bested in a file and JUnit framework will take care of the rest.

Is this feasible with JUnit, any advice please?

APC
  • 144,005
  • 19
  • 170
  • 281
user1669327
  • 135
  • 3
  • 9
  • 1
    JUnit is designed to test Java code. If you are trying to use it to test database procedures for which no Java exists, this might not be the correct framework. That said, if you write Java code to invoke your DB procedures you can test the results with JUnit. – John B Sep 13 '12 at 17:36
  • Thanks John, are there any other frameworks that you can think of which would better suit the requirements ? – user1669327 Sep 13 '12 at 17:50
  • I don't know of any as I don't do much DB stuff. You might want to post a question about it without the junit tag so you get more visibility from DB guys. – John B Sep 13 '12 at 18:16
  • If you're using Oracle, you might want to look at the answer to http://stackoverflow.com/questions/203376/unit-testing-framework-for-oracle-pl-sql. For SQL Server, see http://stackoverflow.com/questions/202940/unit-tests-framework-for-databases. If this is what you want, please close this question. – Matthew Farwell Sep 14 '12 at 07:13
  • It looks like you already have semy-automatic unit testing and wants to automatically run it using junit. You may start with http://dbunit.sourceforge.net/, it is meant to ease database testing. – Jayan Sep 15 '12 at 04:53

0 Answers0