x-testing-conventions

Standardize Go test organization, parallelism, and cleanup conventions.

2|Updated Apr 12, 2026
One-click install
npx skills add https://github.com/pure-golang/level85 --skill x-testing-conventions
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: x-testing-conventions
Source: https://github.com/pure-golang/level85/tree/main/.agents/skills/x-testing-conventions
Command: npx skills add https://github.com/pure-golang/level85 --skill x-testing-conventions

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Skill helps prevent slow or flaky test runs by standardizing how tests are organized by layer, how they are marked for parallelism, and how they follow a consistent AAA structure with reliable cleanup.

Core Features & Use Cases

  • Test Layer Selection & Placement: Ensures tests live in the correct directory/lifecycle layer (unit/features/api-bdd/browser-bdd/smoke) so the right runner is used.
  • Parallelism and Safety Guards: Recommends when to use t.Parallel() and when to avoid it for process-wide state changes (env/cwd/OpenTelemetry/global mutable fixtures).
  • AAA Structure and Cleanup Rules: Enforces Arrange/Act/Assert readability and encourages t.Cleanup-based resource management.
  • Naming and Maintenance Conventions: Promotes consistent case naming and discourages patterns that hide failures (e.g., improper skips).

Quick Start

Apply the x-testing-conventions skill when you add or refactor a Go test so it uses the correct test layer marker and follows AAA with safe isolation.

Frequently Asked Questions about x-testing-conventions

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

FAQPage Schema
How do I prevent flaky Go tests when using t.Parallel()?

Prevent flaky Go tests by avoiding t.Parallel() for tests modifying process-wide state like environment variables, cwd, or global OpenTelemetry fixtures. Standardize parallelism decisions to isolate shared mutable state and ensure safe concurrent execution across test layers.

How do I organize Go tests into the correct test layers?

Organize Go tests by selecting the correct directory and lifecycle layer—unit, features, api-bdd, browser-bdd, or smoke. Proper test layer placement ensures the right runner executes your tests and prevents mis-routed test execution across different testing scopes.

What is the AAA structure in Go testing and how do I apply it?

The AAA structure in Go testing enforces Arrange, Act, and Assert readability. Apply it by separating test setup, execution, and validation into distinct blocks, pairing it with t.Cleanup-based resource management for reliable test isolation and maintenance.

When should I use t.Cleanup instead of defer in Go tests?

Use t.Cleanup instead of defer in Go tests when you need reliable resource management across subtests and parallel execution. t.Cleanup ensures deterministic teardown order and pairs with the AAA structure to maintain explicit, safe test isolation.

Can I run BDD and smoke tests in the same Go test runner?

BDD and smoke tests should live in separate lifecycle layers to prevent mis-routed execution. Standardizing test layer selection ensures API-BDD, browser-BDD, and smoke checks use the appropriate runner, avoiding execution errors and maintaining test consistency.

Why are my Go tests failing inconsistently across runs?

Go tests fail inconsistently due to improper parallelism with process-wide state changes or hidden failure patterns like improper skips. Standardize naming conventions, enforce safe isolation, and apply explicit cleanup to eliminate test flakiness and ensure reliable execution.