with one click
acceptance-testing
// Write and troubleshoot terraform-provider-azurerm acceptance tests safely and consistently (BuildTestData, ExistsInAzure, ImportStep, requiresImport). Use when adding or fixing TestAcc* tests.
// Write and troubleshoot terraform-provider-azurerm acceptance tests safely and consistently (BuildTestData, ExistsInAzure, ImportStep, requiresImport). Use when adding or fixing TestAcc* tests.
| name | acceptance-testing |
| description | Write and troubleshoot terraform-provider-azurerm acceptance tests safely and consistently (BuildTestData, ExistsInAzure, ImportStep, requiresImport). Use when adding or fixing TestAcc* tests. |
When writing or troubleshooting acceptance tests under internal/**/*_test.go, use .github/instructions/testing-compliance-contract.instructions.md as the single source of truth for:
TEST-* rule familiesDo not treat this skill as a second independent compliance source.
Before applying this skill, read this file to EOF.
Before editing tests with this skill, complete this checklist:
.github/instructions/testing-compliance-contract.instructions.md to EOF and applied the relevant TEST-* rules._test.go pattern under internal/**..github/instructions/testing-guidelines.instructions.md.If preflight is incomplete, do not proceed with acceptance-test work.
Use this file for worked examples and specialized testing guidance after loading the contract:
.github/instructions/testing-guidelines.instructions.mdWhen (and only when) this skill is invoked, the assistant MUST append the following line to the end of the assistant's final response:
Skill used: acceptance-testing
Rules:
Skill used: ... line.When you need a placeholder in examples or guidance, always use the explicit token format {{TOKEN_NAME}}.
Rules:
{{RESOURCE_NAME}}, {{TEST_NAME}}).<name> or ....{{...}} token would appear in final output, replace it before responding.Intended for use with the HashiCorp terraform-provider-azurerm repository (acceptance test framework under internal/).
Acceptance tests create real Azure resources and can incur cost.
Before running tests:
Acceptance test framework conventions:
data := acceptance.BuildTestData(t, "azurerm_x", "test")r := SomeResource{}Default resource test matrix should cover the core lifecycle:
basic, requiresImport, complete, update, and import validation when import is supported.New-resource list coverage:
*_resource_list_test.go file.allow-without-list or list-not-supported.Ephemeral-resource coverage:
*_ephemeral_test.go pattern with acceptance.BuildTestData(t, "ephemeral.azurerm_<name>", ...).echo provider plus config-state checks rather than inventing a one-off assertion pattern.Provider-defined function coverage:
internal/provider/function/*_test.go.provider::azurerm::<name>(...) calls.Basic tests should validate existence:
check.That(data.ResourceName).ExistsInAzure(r).Prefer ImportStep:
data.ImportStep() typically provides broad field validation.RequiresImport tests:
requiresImport coverage by default using data.RequiresImportErrorStep.Do not add acctests for simple property validation by default:
Add acctests for CustomizeDiff logic:
ExpectError scenarios for the invalid paths, while letting the broader basic, update, complete, and import flows cover the corresponding success paths unless extra assertions are needed.When a test fails:
Read the error carefully and identify if it is:
Re-run only the failing test:
-run scope possible.If the failure is a state mismatch:
When asked to write tests, produce:
basic TestAccrequiresImport TestAccupdate TestAcccomplete TestAccImportStep()requiresImport coverage when the resource pattern gives a concrete reason that it is not applicable[HINT] Download the complete skill directory including SKILL.md and all related files