Now that I have my database schema creation and maintenance automated with Incanto and dbMaintain I have been looking at testing tools for stored procedures. Perhaps the best known for Oracle PL/SQL are Feuerstein’s utPLSQL and subsequent Quest Code Tester for Oracle. Other options include plunit, PLUTO and ruby-pl-spec. My main requirement, however, has been to invoke tests from an Ant project continuously integrated using Hudson and for now I have started using sqlunit, which is both mature and portable across different databases, as well as allowing relatively simple testcases to be specified in entirely XML.
My build-common.xml now contains
- <br> <path id="sqlunit-lib"><br>
- <fileset dir="${antlibdir}"><br>
- <include name="log4j-1.2.15.jar"><br>
- </include><include name="junit-4.8.1.jar"><br>
- </include><include name="jdom-1.1.1.jar"><br>
- </include><include name="ojdbc14-10.2.0.2.0.jar"><br>
- </include><include name="sqlunit-5.0.jar"><br>
- </include></fileset><br> </path><br>
- <target name="load-sqlunit"><br>
- <taskdef name="sqlunit" <brbr="">
- classname="net.sourceforge.sqlunit.ant.SqlunitTask"<br>
- classpathref="sqlunit-lib"/><br> </taskdef></target><br>
In addition to sqlunit I’ve found
dbUnit to be a useful tool for complex data setup prior to running a test.
Initilization of the dbUnit ant task is done as follows:
- <br>
- <path id="dbunit-lib"><br>
- <fileset dir="${antlibdir}"><br>
- <include name="slf4j-api-1.5.11.jar"><br>
- </include><include name="slf4j-simple-1.5.11.jar"><br>
- </include><include name="ojdbc14-10.2.0.2.0.jar"><br>
- </include><include name="dbunit-2.4.7.jar"><br>
- </include></fileset><br> </path><br>
- <target name="load-dbunit"><br>
- <taskdef name="dbunit"><br>
- classname="org.dbunit.ant.DbUnitTask"<br>
- classpathref="dbunit-lib"/><br> </taskdef></target><br>