DbFit is a set of fixtures which enables FIT/FitNesse tests to execute directly against a database.
The easiest way to get a DbFit test environment is to provision a Linux virtual machine image. The instructions below describe how to do this.
The fully-built VM includes:
- working installs of Maven, MySQL, PostgreSQL, Derby and HSQLDB
- the pre-requisites to easily install Oracle
The VM doesn't include:
- a working Oracle installation (fetching and installing the Oracle binaries and JDBC jar hasn't been automated yet, but is partially described below)
- a working DB2 installation
- a working SQL Server installation (obviously)
Note: the following instructions are Mac OS/Linux specific but the same approach should work under Windows as well, since vagrant and VirtualBox run on Windows.
-
You first need to install VirtualBox. I have been using version 4.1.18. Guest additions are also required.
-
You need to have ruby installed, version 1.8.7 or 1.9.X (I haven't tested with ruby 2.0). The Windows installed can be found here.
-
Run every subsequent command from the
test_vm
folder:cd test_vm
-
Install ruby
bundler
:sudo gem install bundler
-
Install the necessary ruby gems (including
vagrant
):bundle install
-
Install the
vagrant
recipes:bundle exec librarian-chef install
-
Provision and start the vagrant VM:
bundle exec vagrant up
The subsequent steps need to be followed on the project folder within the VM. To get there:
-
First, ssh into the machine:
vagrant ssh
-
The development directory is NFS-mounted under
/var/dbfit
. Change into it:cd /var/dbfit
-
Download the Oracle 10g 10.2.0.2.0 Thin driver (ojdbc14.jar) from the Oracle homepage.
-
From the VM, install it into maven:
mvn install:install-file -Dfile=ojdbc14.jar -DgroupId=com.oracle \ -DartifactId=ojdbc14 -Dversion=10.2.0.2.0 -Dpackaging=jar
Because the edge builds of FitNesse don't get pushed to the Maven Repository, it needs to be manually pushed into the local repo.
-
Download the
fitnesse
jar:wget https://cleancoder.ci.cloudbees.com/job/fitnesse/278/artifact/dist/fitnesse.jar
-
Download the
fitnesse
POM file:wget http://repo1.maven.org/maven2/org/fitnesse/fitnesse/20121220/fitnesse-20121220.pom
-
Update the version string in the POM file:
sed -i 's/20121220/20130216/g' fitnesse-20121220.pom
-
Install the jar:
mvn install:install-file -Dfile=fitnesse.jar -DgroupId=org.fitnesse \ -DartifactId=fitnesse -Dversion=20130216 -Dpackaging=jar -DpomFile=fitnesse-20121220.pom
-
Download the
fitlibrary
jar:wget https://s3.amazonaws.com/dbfit/fitlibrary-20081102.jar
-
Install the fitlibrary JAR [...]
mvn install:install-file -Dfile=fitlibrary-20081102.jar -DgroupId=org.fitnesse \ -DartifactId=fitlibrary -Dversion=20081102 -Dpackaging=jar
Note: These instructions are work in progress.
-
Download the
Oracle XE 11g for Linux x64
RPM from Oracle from inside the VM. -
Install the RPM:
sudo yum install <rpm-name.rpm>
-
TODO...
-
Install the root project POM into the local Maven repo:
dbfit-java$ mvn -N install
-
Install the
dbfit-core
:core$ mvn install
-
Build and package all the subprojects:
dbfit-java$ mvn package
-
Logging in as
root
formysql
:mysql -u root
-
Logging in as the
postgres
superuser forpostgresql
:sudo su postgres psql dbfit
-
Logging in as the
system
superuser fororacle
:sqlplus system/system
DbFit is released under the GNU General Public License, version 2.