Back to Skills

run-acceptance-tests

Guide for running acceptance tests for a Terraform provider. Use this when asked to run an acceptance test or to run a test with the prefix `TestAcc`.

682stars77forksUpdated 6/24/2026

Security Assessment

Safe(100/100)
Security Score100/100

About run-acceptance-tests

Guidance for running acceptance tests for a Terraform provider. In this context an acceptance test is a Go test function whose name carries the `TestAcc` prefix, and the skill is intended for use whenever someone asks to run an acceptance test or to run a test with that prefix.

To run a focused acceptance test, the skill invokes `go test -run=<TestName>` with the `TF_ACC=1` environment variable set, defaulting to non-verbose output. Because acceptance tests for specific providers may require additional environment variables, when the test output indicates missing variables the skill suggests how to set them up securely. For diagnosing a failing acceptance test, it applies a set of cumulative options in order, each building on the ones above it: rerun the test with `-count=1` so `go test` does not use a cached result; offer verbose output with `-v`; offer debug-level logging by setting `TF_LOG=debug`; and offer to persist the test's Terraform workspace by setting `TF_ACC_WORKING_DIR_PERSIST=1`.

The skill also addresses the risk that a passing acceptance test may be a false negative. To validate a passing test, it describes a flip procedure: edit the value of one of the TestCheckFuncs in one of the TestSteps within the TestCase, run the test, and expect it to fail. If the test fails as expected, the edit is undone and a successful flip is reported; otherwise the edit is kept and an unsuccessful flip is reported, signaling that the test does not actually exercise what it claims.

FAQ

What counts as an acceptance test here?

A Go test function with the `TestAcc` prefix. The skill is used when asked to run such a test or any test with that prefix.

How do I run a single focused acceptance test?

Run `go test -run=<TestName>` with the `TF_ACC=1` environment variable set, defaulting to non-verbose output. If the output indicates missing provider-specific variables, the skill suggests how to set them up securely.

What is the recommended order for diagnosing a failing test?

Cumulatively: rerun with `-count=1` to avoid a cached result, then add `-v` for verbose output, then set `TF_LOG=debug` for debug logging, then set `TF_ACC_WORKING_DIR_PERSIST=1` to persist the Terraform workspace.

Why would I rerun with -count=1?

To ensure `go test` does not use a cached result, so you observe a fresh run of the test rather than a previously cached outcome.

What is the flip procedure for a passing test?

Edit the value of one of the TestCheckFuncs in one of the TestSteps in the TestCase and run the test, expecting it to fail. If it fails, undo the edit and report a successful flip; if it still passes, keep the edit and report an unsuccessful flip.

Install run-acceptance-tests

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill