Cassandra Integration Testing


Cassandra Unit is a library which can intergrate with your Java code and help dynamically spin up an embedded Cassandra instances when needed. Once you are done using this instance, you can just termiated it and the library will take care of cleaning up after it.

What purpose does this library serve ?

  1. Biggest advantage is in
    testing. Developers or CI/CD tools no longer need to depend on a centralized database.
  2. Developers can run all kinds of test scenarios on their code and also test you their DML/DDL queryies before executing them on main Cassandra Cluster. Which means faster development, reduced latency and dependency.

##Steps for Spring JUnit :

1. Include the following dependencies in pom.xml

<!--Cassandra Unit Integration With Spring -->

<!--Cassandra Unit Library-->

2. Annotate your Junit class with the following

@SpringApplicationConfiguration(classes = CassandraConfiguration.class)

@TestExecutionListeners({ CassandraUnitDependencyInjectionTestExecutionListener.class,
DependencyInjectionTestExecutionListener.class })

@CassandraDataSet(value = { "create-table.cql" }, keyspace = "ioe")




3. Place your DDL queries in a file named ‘create-table.cql’under /resource folder of your TEST

Leverage the Jmeter plugin for Cassandra developed by Netflix.

Elankumaran Srinivasan

Elankumaran Srinivasan
I am a software engineer, Java and open source technonogy enthusiast.

Counter-Badging Service Architecture

Most of the applications have some sort of badging functionality which is used to display certain counts to the users for CTA (Call To Ac...… Continue reading

Hystrix, Turbine with Spring Boot Admin

Published on April 16, 2017

Implementing CHAT system with MongoDB Atlas

Published on February 27, 2017