Tuesday, February 3, 2015

Testing Cassandra applications: Stubbed Cassandra 0.6.0 released

Stubbed Cassandra (Scassandra) is an open source test double for Cassandra. Martin Fowler has a very general definition of what a test double actually is.

When I refer to a test double I mean stubbing out at the protocol level. So if your application makes calls over HTTP, your test double acts as an HTTP server where you can control the responses, and most importantly: inject faults. Wiremock is a great example of a test double for HTTP.

I like this kind of stubbing out as it allows me to really test drivers / network issues etc. Deploying to cloud environments where network/servers going down happens more frequently makes this even more important. If you're using a JVM language and all this happens in the same JVM it is also quick.

Why is this release important?


This is an important release for Scassandra as it now supports all types, previously it only supported the subset of CQL that my old employer, BSkyB, used. Now's a good time to mention that this tool was developed completely in my own time and not while working there :)

It still has lots of limitations (no user defined types, no batch statements, no LWT) but as it is designed to test individual classes it is still usable for all your code that doesn't use these features even if they are used some where in your application.

I had previously used it for full integration tests, in that case it had to support your entire schema. I have stopped doing that as I intend to build a different type of Cassandra testing tool for that using CASSANDRA-6659. This JIRA extracted an interface for handling queries, which I want to use to inject faults/delays etc. If you haven't used Scassandra before it is important to know it doesn't embed a real Cassandra, it just implements there server side of the native protocol and "pretends" to be Cassandra.

Version 0.6.0 has a view of Cassandra 3.0, where embedded collections are likely to be supported. Previously you used an enum to inform Scassnadra what your column types are, or the variables in prepared statements.  For example:


Here the withColumnTypes method on the builder informs Scassandra how to serialise the rows passed into withRows.

This worked for primitive types e.g Varchar, Text. But what about collections? Sets were supported first so I went with VarcharSet etc, bad idea! What about Maps? That is a lot of combinations, and even worse List<Map<String, Int>>?

An enum was a bad idea, so in 0.6.0 I've introduced the CqlType, this has sub classes for Primitive/Collections and there is a set of static methods and constants to make it nearly as convenient as an enum for the simple types. The advantage of this is I can now embed types inside each other e.g


And then when Cassandra 3.0 comes we can have things like map(TEXT, map(TEXT, TEXT)) for a multi map.

The end goal is actually for you to give your schema to Scassandra and it will just work this out. This is some way off as it requires being able to parse CQL and at the moment Scassandra just pattern matches against your queries.

Happy testing and as always any feature requests/feedback just ping me on twitter @chbatey

17 comments:

Becker said...

Humans are not immune from making mistakes. There are small and large errors that learners of Ignou university make, while others can be easily detected by spell-checkers. There are many steps you can take to make sure you get good grades in your Ignou MFNP12 Project. These steps are also recommended by an MSCDFSM project assistance expert. If you are looking for Ignou MSCDFSM Project feel free to order from our website.

Becker said...

Humans are not immune from making mistakes. There are small and large errors that learners of Ignou university make, while others can be easily detected by spell-checkers. There are many steps you can take to make sure you get good grades in your Ignou MFNP12 Project. These steps are also recommended by an MSCDFSM project assistance expert. If you are looking for Ignou MSCDFSM Project feel free to order from our website.

Lucas said...

Retten smagte skam godt, men kunne ikke leve op til forventningerne. take away lyngby hovedgade Mango Lassie, som vi nød til middagen, var helt perfekt.

Debbie Brinkmann said...

You provide a lot of useful information in your article. Recently, I wrote an article about Introduction Of CPS Or Kohi Click Speed Test. Game players who play games like Minecraft are the majority of visitors to the Kohi Click Test. The completion of a mission or winning a fight in such games requires a high level of click speed. We discuss this in the article. So, you can read this information about the Kohi Click Test - Best CPS Test!.

custom boxes said...


like the futuristic spot UV, holographic foil stamping, silver foil printing, pizza boxes and various others. Moreover, branding and printing of tags, brands’ names, or signature are also among the services we provide (which works like magic for advertising purposes)

MalaysiaAssignmentHelp said...

Final year exams are approaching but the final year project is not completed yet, Don't worry just take Final year project help from Malaysia assignment help and get your final year project done by our expert team with original content at affordable rates

Gyaanshala said...

life lessons from Mahabharata are very important for us as they are very valuable in current situation.

Alex Kim said...

Nice post on Testing Cassandra applications: Stubbed Cassandra 0.6.0 released.Use chinese to english translation service singapore from Singapore translators and convert the Chinese written text of your report card into English by the help of Singapore translators. They provide you exact report card translation at the very lowest price.

Olivia Wilson said...

Are you overwhelmed with your finance assignment help and why you need education after all? All students have loaded their shoulders with the massive weight of their homework and assignments.
What is Education?
When you study to gain in-depth knowledge and understand the needs of everything you do in your daily life, this is called education. One can’t earn knowledge only from books. 
If you want to save your time from doing math assignments, you can take economics assignment help from any reputed online website.
Gives stability
No one can ever take away the stability you have gained from your education. So, you can allow yourself to take a college degree or diploma. It will help you to discover the right career path. Education opens the doors to new destinations. 
Provides financial security
If you are careful about your education, then there is a chance of getting high-paid jobs. In addition, good education will help you to practice dissertation writing help to get a good job. 
Needed for equality
We are keen to get an equal world for ourselves. And this journey should begin with education. If everyone receives the same educational opportunities, there will be no gap or different classes in society. 
It can protect you
You have no idea how education help in academic writing services. It’s not only about financial independence. People often take advantage of those persons who do not know how to write or read. 
Confidence
If you want to be successful in your life, you need to be confident. But what is the best way to edit my essay? The answer is education. It helps you to prove your knowledge. And it gives you the power of speaking your mind. 
Personal growth
Education helps us to ask questions. It boosts our self-dependency level, and the desire to know more about the world grows us internally.
Break barriers
Education helps to create a bridge between people. It allows people to be empowered. Education frees your mind.  
We have a few more services: CHC50113 Assessment Answers|GCNCP3 Assignment Answers|ITC542 Task Answers| 101644 Solutions| 102048 Answers

assignment help said...

Immediate english assignment help services @50%off. Get online english assignment help from Native experts in given deadline. Plagiarism-free, 3000 Experts.

Zackrobert said...

To keep your business thriving, convert your Quicken data to QuickBooks Desktop. Converting directly to QuickBooks Desktop or using the Quicken converter to upgrade your file first are two simple methods to get started with the transfer. Quicken for Mac is a program that allows you to keep track of your finances Quicken Converter and QuickBooks' Conversion Utility are unable to convert Quicken for Mac data files. If you're using Quicken for Mac, you'll need to convert your data file to Quicken for Windows first or create a new QuickBooks company file. Make sure you don't have another version of this program installed before using it.

Essien said...

Nice post! I have found this site educative and inspiring; thanks for writing an amazing drip write-up, nice post keep it up. Thanks a lot for sharing. adeleke university post utme de form

hastenchemical said...

fly ash Oklahoma is a widely utilized material in Oklahoma's construction industry, offering numerous advantages. By incorporating fly ash into concrete production, Oklahoma promotes sustainable building practices, including improved strength, reduced carbon emissions, and efficient waste management. This utilization of fly ash contributes to the state's commitment to eco-friendly infrastructure development.

Arthur Wilson said...


While in higher education, students are required to submit various assignments, projects, and research works. These are necessary, as these activities can help for building a bridge between theoretical knowledge to the practical world. But, writing an assignment or doing project work requires in-depth subject knowledge, and time-consuming research.
In order to solve these problems, Global Assignment Help has brought an assignment help service for the students of the United States of America, the United Kingdom, Canada, Australia, and New Zealand. The experts of the organization are dedicated to providing plagiarism-free assignments, maintaining the academic standards, and customization on-time. They provide correct and precise information about the concepts, and the recent technological developments, so that the quality of the assignments are enhanced. By taking services from the organization, students can achieve good academic grades, and pave their way to future success.

Ramma Foundation Repair said...

"Ramma Foundation Repair offers top-tier solutions for Edmonton foundation repair, ensuring structural integrity. With expert services and a proven track record, trust Ramma for all your foundation repair needs in Edmonton."

CV Writing Services said...
This comment has been removed by the author.
CMOLDS Dubai said...

Elevate your digital presence with CMOLDS, the premier app development company dubai. Our expert team combines innovation and expertise to deliver cutting-edge mobile solutions tailored to your needs. Trust CMOLDS to bring your app ideas to life and make a mark in the competitive digital landscape of Dubai.