Skip to main content

Eclipse Plug-in for Generating and Executing Test Cases for Database Objects

An Eclipse plug-in capable of automatically generating JUnit and SQLUnit test cases for database objects.

Date Posted: December 11, 2008

alphaworks tab navigation


 

Update: February 27, 2009
Fixes to software include INOUT type parameters and VARBINARY data type. Added a step to the documentation to guide users to download JDBC drivers.

 

What is Eclipse Plug-in for Generating and Executing Test Cases for Database Objects?

The Eclipse Plug-in for Generating and Executing Test Cases for Database Objects (TC4DBO) enables users to automatically generate JUnit or SQLUnit test cases for database objects. By using defined code templates and parameter templates, the repetitive effort of handling the objects is significantly reduced.

The plug-in includes wizards that

The tool is compatible with all Eclipse versions above 2.0, and it can be installed on many Eclipse-based software development tools, such as Rational® Data Studio, Rational Application Developer, and of course, Eclipse itself. It contains a friendly user interface for test case generation, execution, and test result verification. Currently, it supports leading database systems including DB2®, SQL Server 2000, Oracle, and Informix database servers. The complete package includes the plug-in, the guide, and both JUnit and SQLUnit sample test case files.

How does it work?

TC4DBO includes three wizards for generating test cases as well as one right-click menu for setting up, when needed, a classpath for a certain projects. The plug-in incorporates a set of APIs that support the execution of unit test cases and verification of the results.

The decision to use JUnit test framework or SQLUnit framework is up to users. TC4DBO plug-in provides two wizards for generating these two kinds of test cases. Those who choose to use the SQLUnit framework must separately download the SQLUnit package.

The JUnit test case wizard can be used to generate JUnit test cases for the Stored Procedures (SP) or UDFs according to the name list that the user provides to the wizard. The user first uses the right-click menu to automatically set up the classpath for the project whose test cases will be placed. Newly generated test cases can then be run as JUnit test cases. An XML file is produced after each test case is run. Finally, a default Internet Explorer browser window is opened and a report is displayed.

Similarly, the SQLUnit test case wizard can be used to generate SQLUnit test cases for the Stored Procedures or UDFs selected from the name list by the user.

The third wizard is the parameter file wizard, which can be used to automatically collect SP/UDF parameter configurations into a separate XML file for the user-specified test case. The generated parameter file can be edited and duplicated for different testing purposes and can be used later in the JUnit test case wizard or the SQLUnit test case wizard. Both these wizards select a parameter file, which is then parsed to extract the SP/UDF information and parameter names, types, and values in order to generate the desired test cases. The greatest benefit is that the user need not specify the parameter values again for each new test case.

The APIs in the package encapsulate all JDBC calls needed for Database Object testing and verification. Proper APIs are applied in the generated JUnit test case. Users need not worry about JDBC APIs such as CallableStatement, PreparedStatement, etc. They need only use some simple APIs provided in this package in order to run SPs/UDF/SQLs, such as runSQL(), runSP(), runUDF(), getObject(), and getResultSet(). The resultant JUnit test cases can be run immediately because all essential APIs have been incorporated in this release.

About the technology author(s)

Jia (Joe) Tao Li is an IBM certified ITA with nine years of experience on software development and testing as well as three years of experience on J2EE application architecture and project management. Mr. Li joined IBM in 2002 as a software engineer, testing WebSphere® application servers. At the end of 2003, he joined the IBM Distributed Software solution development team as a Java and DB2 developer. Now he works closely with the DSW U.S. team as an ITA of the China team.

Jun (Thomas) Qing Zhang is a software engineer with six years of experience in software development and testing on J2EE application architecture. Mr. Zhang joined IBM in 2006 as a software engineer. He has been working in the IBM Distributed Software solution development team for about two years.

Wei (Will) Chang is a software engineer with four years of experience on J2EE application architecture and over 2 years of experience on DB2 Stored Procedure development. Mr. Chang joined IBM in 2007 as a software engineer and has been working in the IBM Distributed Software solution development team for over a year.

Trademarks




Related technologies