October 29th, 2013

Hi everyone,
Let me present you CassandraUnit!
I work for few months on a new Java application with a Cassandra database backend.
As I’m A TDD Lover, I’d like to developp in a pure TDD Style combined with continuous integration system like Jenkins.
The difficulty when using a database backend is how to write isolated unit Test. One of solutions is to :
  • first : embed an instance of your database in your unit test.
  • next : load data into your database to setup your unit test.
  • finally : execute your test with your data.

In a Relational database world, there is some tools to help you like DBUnit. As Cassandra is a relatively young product (but so beautiful :-)), I didn’t find some tools to help me doing what I want.
CassandraUnit is born.
What does it do?
CassandraUnit, for now, does :
  • embed and start a Cassandra instance in your code if you want.
  • load data from a dataset (xml).
A very little example?
  • create an xml dataset like that “simpleDataSet.xml” :

  • create a JUnit test case witch extends AbstractCassandraUnit4TestCase :

And now?
It was just a very little example. CassandraUnit allows to make more complex dataSet (Super column, type definition, …).
I’ve just published it on github. It is published under LGPL v3.0 license.
The first release will be available on maven central repository in the coming hours.
As it’s the first release, It probably still missing a lot of functionnality but it was time for me to published it.
You want to go further?
and it’s normal 🙂
Here you can find more informations :

You can follow it on twitter @cassandraunit
I hope it will help you as it helps me every day on my project.