github.com/darmach/terratest@v0.34.8-0.20210517103231-80931f95e3ff/docs/_docs/02_testing-best-practices/alternative-testing-tools.md (about)

     1  ---
     2  layout: collection-browser-doc
     3  title: Alternative testing tools
     4  category: testing-best-practices
     5  excerpt: >-
     6    Learn more about alternatives to Terratest, and how Terratest compares to other testing tools.
     7  tags: ["testing-best-practices", "alternatives"]
     8  order: 211
     9  nav_title: Documentation
    10  nav_title_link: /docs/
    11  ---
    12  
    13  ## A list of infrastructure testing tools
    14  
    15  Below is a list of other infrastructure testing tools you may wish to use in addition to Terratest. Check out [How
    16  Terratest compares to other testing tools]({{site.baseurl}}/docs/testing-best-practices/alternative-testing-tools/#how-terratest-compares-to-other-testing-tools) to understand the trade-offs.
    17  
    18  1.  [kitchen-terraform](https://github.com/newcontext-oss/kitchen-terraform)
    19  1.  [rspec-terraform](https://github.com/bsnape/rspec-terraform)
    20  1.  [serverspec](https://serverspec.org/)
    21  1.  [inspec](https://www.inspec.io/)
    22  1.  [Goss](https://github.com/aelsabbahy/goss)
    23  1.  [awspec](https://github.com/k1LoW/awspec)
    24  1.  [Terraform's acceptance testing framework](https://github.com/hashicorp/terraform/blob/master/.github/CONTRIBUTING.md#acceptance-tests-testing-interactions-with-external-services)
    25  1.  [ruby_terraform](https://github.com/infrablocks/ruby_terraform)
    26  
    27  
    28  
    29  ## Why Terratest?
    30  
    31  Our experience with building the [Infrastructure as Code Library](https://gruntwork.io/infrastructure-as-code-library/)
    32  is that the _only_ way to create reliable, maintainable infrastructure code is to have a thorough suite of real-world,
    33  end-to-end acceptance tests. Without these sorts of tests, you simply cannot be confident that the infrastructure code
    34  actually works.
    35  
    36  This is especially important with modern DevOps, as all the tools are changing so quickly. Terratest has helped us
    37  catch bugs not only in our own code, but also in AWS, Azure, Terraform, Packer, Kafka, Elasticsearch, CircleCI, and
    38  so on. Moreover, by running tests nightly, we're able to catch backwards incompatible changes and
    39  regressions in our dependencies (e.g., backwards incompatibilities in new versions of Terraform) as early as possible.
    40  
    41  
    42  
    43  ## How Terratest compares to other testing tools
    44  
    45  Most of the other infrastructure testing tools we've seen are focused on making it easy to check the properties of a
    46  single server or resource. For example, the various `xxx-spec` tools offer a nice, concise language for connecting to
    47  a server and checking if, say, `httpd` is installed and running. These tools are effectively verifying that individual
    48  "properties" of your infrastructure meet a certain spec.
    49  
    50  Terratest approaches the testing problem from a different angle. The question we're trying to answer is, "does the
    51  infrastructure actually work?" Instead of checking individual server properties (e.g., is `httpd` installed and
    52  running), we'll actually make HTTP requests to the server and check that we get the expected response; or we'll store
    53  data in a database and make sure we can read it back out; or we'll try to deploy a new version of a Docker container
    54  and make sure the orchestration tool can roll out the new container with no downtime.
    55  
    56  Moreover, we use Terratest not only with individual servers, but to test entire systems. For example, the automated
    57  tests for the [Vault module](https://github.com/hashicorp/terraform-aws-vault/tree/master/modules) do the following:
    58  
    59  1.  Use Packer to build an AMI.
    60  1.  Use Terraform to create self-signed TLS certificates.
    61  1.  Use Terraform to deploy all the infrastructure: a Vault cluster (which runs the AMI from the previous step), Consul
    62      cluster, load balancers, security groups, S3 buckets, and so on.
    63  1.  SSH to a Vault node to initialize the cluster.
    64  1.  SSH to all the Vault nodes to unseal them.
    65  1.  Use the Vault SDK to store data in Vault.
    66  1.  Use the Vault SDK to make sure you can read the same data back out of Vault.
    67  1.  Use Terraform to undeploy and clean up all the infrastructure.
    68  
    69  The steps above are exactly what you would've done to test the Vault module manually. Terratest helps automate this
    70  process. You can think of Terratest as a way to do end-to-end, acceptance or integration testing, whereas most other
    71  tools are focused on unit or functional testing.