To develop db2unit you need:


The code is divided in two parts:


Main (src/main directory)

The code here produces the delivrable code.

Assembly (src/main/assembly directory)

This file contains the mechanism to create the release package.


Code of db2unit. This is the main part of this project.


Scripts to install and uninstall db2unit in multiple platforms. Windows with CMD and PowerShell. Linux and AIX with Bash and Korn.

Test (src/test directory)

The code under this directory has everything to test the main code.

Maven (src/test/maven directory)

Scripts for the differents phases of the lifecycle. The scripts are fully supported for Linux / AIX in Bash. There are scripts with some functionality for Windows in CMD.


Scripts to develop in db2unit, without using Maven (However, Maven invokes them). These scripts are used to retest each time something is modified in the files.


Set of tests to test db2unit itself. Each file tests the assertions for a specific data type independently. If you are changing something for a specific data type, you can run its corresponding assertions file. Instead, if you modify something general, the execution file could be run to test the general behavior.

Travis-CI (src/test/travis directory)

Files to be used by Travis-CI. These are the Db2 response files and a script for Linux Ubuntu update in parallel.

Examples (src/examples directory)

There is an examples directory that contains scripts with many possible situations for tests. When a new feature needs to be explained, this is the place to put that.

Website (src/site directory)

This directory contains everything for the website published in https://db2unit.github.io.

Documentation (docs directory)

This directory contains everything you need to know to use or to develop in db2unit.


There are a couple of examples in db2unit, that you could install and execute that helps you understand how this project works.

This is a complete file, with setup and tear down and a set of different possibilities for tests.


Fails before each test because of the setup.


Fails the suite at the beginning.


How to develop


With Maven, in the root directory

# Cleans the environment.
mvn clean
# Verifies if the environment is correctly configured to install db2unit.
mvn validate
# Creates the database to install db2unit and its prerequisites.
# (Linux) It needs log4db2.tar.gz in /tmp to be installed dynamically.
# (Windows) It needs log4db2 extracted in the Downloads folder.
mvn create
# Installs db2unit in the database.
mvn compile
# Installs the tests to test db2unit (test itself).
mvn test-compile
# Executes the set of Tests Suites to test db2unit. This takes several minutes.
mvn test

# Creates the package (zip and tar.gz) to be released.
# Creates the db2unit site.
mvn site
# Deploys the db2unit site in GitHub pages.
mvn site-deploy

If you cannot have a Db2 server in your own machine, and you need to use a remote one, you can catalog a remote node called db2unit, and then create the database in another instance. For this, you need to execute this:

db2 catalog tcpip node db2unit remote ServerName server PortNumer

Where ServerName is the Name or IP address your remote server and, PortNumber is the port where Db2 is listening.


You can use the set of scripts to recreate/reinstall db2unit and tests all or parts of the code. The same script with different extensions works for different platforms:


If the global variable DEVELOPMENT is set, then the execution is verbose when running Db2 commands. The execution is with the dot command (source):

. ./install



These are a set of scripts to develop db2unit, without recreating the database.

An example is:

. ./test mySuite i x

This installs and executes the mySuite tests suite.

In Windows, you do not need the . command.


These are a set of scripts used for Maven.