Folks, Knoldus has always pioneered the deep diving into the best ways to use cutting edge technologies. In the past few days, one of our team carried this deed by integrating Cucumber with Akka-Http, Cassandra and of course, Scala. In this blog, we reach out to you to explain and show how this can be done.
Cucumber is for Behavior Driven Design (BDD). The approach of Cucumber is to write the behavior of the application and then run them for acceptance testing.
Akka-Http is a general toolkit provided by Akka to implement HTTP services. It supports both client and server side services.
Cassandra is a database that provides high scalability and availability with best performance.
All these three have been integrated with Scala in this endeavor. We have used a plugin available here that integrates Cucumber with Sbt. Through this we will be able to execute our test cases using both the commands –
sbt cucumber and
You may find the entire code of the application here.
It is important to notice the build.sbt of this project. We have tried to use all the latest dependencies. Then there is line
CucumberPlugin.glue := "allTest"
This line tells the Cucumber where to find its steps files. In this case, all are in the allTest package. All the Cucumber feature files are in the resource package.
If you perform
sbt cucumber all the test cases will be executed. Then there is line
testFrameworks += new TestFramework("allTest.runner")
This will enable all the test cases of cucumber to run through command
The rest of the code is pretty simple and you should go through it. You may clone the project and test it on your local machines. We are open for questions and suggestions. Reach out to us.
Happy Blogging !