run-acceptance-tests

Run Go-based Terraform provider acceptance tests with focused TestAcc commands.

790|117|Updated Nov 8, 2025
One-click install
npx skills add https://github.com/hashicorp/agent-skills --skill run-acceptance-tests
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: run-acceptance-tests
Source: https://github.com/hashicorp/agent-skills/tree/main/terraform/provider-development/skills/run-acceptance-tests
Command: npx skills add https://github.com/hashicorp/agent-skills --skill run-acceptance-tests

SYSTEM DOCUMENTATION & REQUIREMENTS

## What problem does it solve?

Acceptance testing for Terraform providers can be slow and error-prone. This Skill standardizes how to run focused acceptance tests, diagnose failures, and manage the test environment to accelerate provider validation.

## Core Features & Use Cases

  • Focused test execution using go test -run with TestAcc prefixes to target specific acceptance tests.
  • Guided diagnostic workflow with incremental options: -count=1 to avoid caching, -v for verbose output, TF_LOG=debug for debugging, and TF_ACC_WORKING_DIR_PERSIST to persist the workspace.
  • Environment setup and usage guidance for TF_ACC, TF_LOG, and related variables during Terraform provider acceptance testing.

### Quick Start

Examples:

  • go test -run=TestAccFeatureHappyPath TF_ACC=1
  • go test -run=TestAccFeatureHappyPath -v TF_ACC=1

Frequently Asked Questions about run-acceptance-tests

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run focused Terraform provider acceptance tests?

Run focused Terraform provider acceptance tests by executing `go test -run` with `TestAcc` prefixes to target specific tests. You must set `TF_ACC=1` to enable acceptance testing mode for reliable execution.

Why does my Terraform provider acceptance test use cached results?

Terraform provider acceptance tests use cached results because of default test caching. Bypass this by passing `-count=1` to your `go test` command, forcing a fresh execution of the `TestAcc` functions.

How do I debug failing TestAcc provider tests?

Debug failing `TestAcc` provider tests by adding the `-v` flag for verbose output and setting `TF_LOG=debug`. This provides detailed execution logs to diagnose failures efficiently.

Can I persist the workspace directory after a TF_ACC test run?

Yes, you can persist the workspace directory after a `TF_ACC` test run by setting the optional `TF_ACC_WORKING_DIR_PERSIST` environment variable to retain the test environment state.

Do I need TF_ACC set to run Terraform provider acceptance tests?

Yes, `TF_ACC` must be set to run Terraform provider acceptance tests. It acts as a required environment variable safeguard to prevent accidental execution of resource-intensive acceptance tests.