Cassandra, Integration Test, Spring Boot

How to add a simple context load test for Embedded Cassandra using Spring Boot ?

@RunWith(SpringRunner.class)
@TestExecutionListeners(listeners = {
    YourCassandraRelatedDependencyListeners.class})
@CassandraDataSet(value = {
    "/setup.cql"}, keyspace = "your-defined-space")
@EmbeddedCassandra(timeout = 50000L)
@SpringBootTest(classes = {
    YourApplication.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, properties = {
        "spring.cloud.config.label=integration-test"})
@TestPropertySource(locations = {
    "classpath:embeddedCassandra.properties",
    "classpath:krypt.properties",
    "classpath:ldap.properties"})
@Category(value = IntegrationTest.class)
public class YourApplicationIT
{
    @Test
    public void contextLoad()
    {
    }
}

Leave a Reply