Infrastructure Code Deserves Tests Too

Get Started

What is Test Kitchen?

Test Kitchen provides a test harness to execute infrastructure code on one or more platforms in isolation.

A driver plugin architecture is used to run code on various cloud providers and virtualization technologies such as Vagrant, Amazon EC2, Microsoft Azure, Google Compute Engine, VMware vSphere, Docker, and more. Read more

Many testing frameworks are supported out of the box including Chef InSpec, Serverspec, and Bats

For Chef Infra workflows, cookbook dependency resolution via Berkshelf or Policyfiles is supported or include a cookbooks/ directory and Kitchen will know what to do.

Test Kitchen is used by all Chef-managed community cookbooks and is the integration testing tool of choice for cookbooks.

  name: vagrant

  name: chef_infra

  - name: ubuntu-20.04
  - name: windows-2022

  - name: client
      - recipe[postgresql::client]
  - name: server
      - recipe[postgresql::server]
$ kitchen create

$ kitchen converge

$ kitchen setup

$ kitchen verify

$ kitchen destroy

How do I run Test Kitchen?

There are five basic commands to provision platforms and test infrastructure code.

--> Running rspec test suites

  ✔ git binary is found in PATH

3 tests, 2 failures

Finished verifying

<default-ubuntu-2004> (0m0.98s).

--> Destroying

--> Test Kitchen is finished.

How do I get started?

Install the Chef Workstation to get started. Alternatively, install the gem directly with gem install test-kitchen.

Get Started