2015 Blogs, Blog

Test Driven Development of Chef Cookbooks for Windows Platform using Test Kitchen

Test Kitchen is an integration tool for developing, testing infrastructure code on isolated target platforms and being used in TDD approach for Chef Cookbooks.


Till 1.3.x version of Kitchen windows platform was not supported. With the latest release of kitchen-1-4-0 now you can create instance with various versions of Windows, which adds a benefit to Chef Cookbook’s test driven development and provides the ability to test cookbooks written for windows platform.



In this post we’ll cover the step-by-step approach to setup the workstation on windows in order to use it for test kitchen with windows instances created using vagrant.


Prerequisites


The following software are required :



  • Virtualbox: Software that allows virtualized environments to run on your system.

  • vagrant: Software that provides an easy to use interface with various virtual environment providers.


Install vagrant (version >= 1.7.2 )and Virtualbox (version >= 4.3.30) for your system using the directions provided on their websites.


Next is installing Chef and test kitchen related gems. The best way to do it is installing ChefDK which comes with Test-Kitchen and other required gems.



If you have installed chef separately then you need to install below mention gems:


gem install test-kitchen –version “~> 1.4″ 
gem install kitchen-vagrant –version ”~> 0.17″  #vagrant driver for kitchen
gem install winrm-transport  #required to spin up windows instances


Author


Avatar