Announcing the Release of Test Kitchen 1.0.0

It is very exciting to announce the release of Test Kitchen 1.0.0 this week. This history of this project is long and winding but if you’re interested check out the Test Kitchen #ChefConf 2013 talk for the background.

Test Kitchen is a test harness tool to execute your configured code on one or more platforms in isolation. In the context of Chef, Test Kitchen helps you run your cookbooks in the various deployment environments you are targeting. There is a driver plugin architecture which lets you run your Chef code on various cloud providers and virtualization technologies such as Amazon EC2Blue BoxCloudStackDigital OceanRackspace,OpenStackVagrantDockerLXC containers, and more. Cookbook dependency resolver tools such asBerkshelf and Librarian-Chef are supported or you can simply have a cookbooks/ directory and Test Kitchen will know how to use it. On the testing front, many test frameworks are already supported out of the box including BatsshUnit2RSpecServerspec, with others created weekly. Support for Test Kitchen is already included in many community cookbooks such as the MySQLnginxChef Server, and runit cookbooks.

If you want to see Test Kitchen working, check out an early demo by Dr. Nic Williams, Fletcher Nichol’s recent Devopsdays Vancouver talk (with live demo), or a quick preview of running kitchen init anyhwere.

We’re happy to have a Getting Started Guide, which gets you up and running and walks you through the development of a simple Chef cookbook. However if you want to jump in, here’s a quick way to get started, assuming you have Ruby 1.9 or greater and Vagrant installed. Test Kitchen is a RubyGem and can be installed with:

$ gem install test-kitchen

If you use Bundler, you can add gem "test-kitchen" to your Gemfile and make sure to run bundle install.

Next add support to your library, Chef cookbook, or empty project with kitchen init:

$ kitchen init

.kitchen.yml will be created in your project base directory. This file describes your testing configuration; what you want to test and on which target platforms. Each of these suite and platform combinations are called instances. By default your instances will be converged with Chef Solo and run in Vagrant virtual machines.

Get a listing of your instances with:

$ kitchen list

Run Chef on an instance, in this case default-ubuntu-1204, with:

$ kitchen converge default-ubuntu-1204

Destroy all instances with:

$ kitchen destroy

You can clone a Chef cookbook project that contains Test Kitchen support and run through all the instances in serial by running:

$ kitchen test

There is help included with the kitchen help subcommand which will list all subcommands and their usage:

$ kitchen help test

So if you’ve been waiting to give Test Kitchen a try there’s never been a better time to start than today!

Author Fletcher Nichol

Fletcher Nichol is a software developer from Edmonton, Canada who has worked in jobs ranging from systems administrator to web application developer. He enjoys playing the drums and taking walks on warm summer days with an audiobook in his ears. He is active in many automation and testing projects such as Chef and Docker and is the lead developer of Test Kitchen.