test-structure-anatomy

Structures individual tests using AAA, Given-When-Then, and table-driven patterns.

Updated Jun 24, 2026
One-click install
npx skills add https://github.com/Hakkadaikon/hymme --skill test-structure-anatomy-hakkadaikon
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-structure-anatomy
Source: https://github.com/Hakkadaikon/hymme/tree/main/skills/test-structure-anatomy
Command: npx skills add https://github.com/Hakkadaikon/hymme --skill test-structure-anatomy-hakkadaikon

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing a single test without a clear internal structure leads to bloated setups, multi-behavior assertions, and tests that cannot be mapped one-to-one to the behaviors they verify. This Skill defines the internal anatomy of one test so each test verifies exactly one behavior and stays traceable to a test ledger entry. ## Core Features & Use Cases - AAA Pattern (Arrange-Act-Assert): Splits a test body into preparation, execution, and verification stages separated by blank lines, with a one-line Act and single-concern Assert. - Given-When-Then (BDD): Expresses the same three-stage structure in business vocabulary so acceptance scenarios and Gherkin specs map one-to-one to tests. - Table-Driven / Parameterized Tests: Runs equivalence-class representatives and boundary values through one test definition via it.each with dynamic per-row labels. - Use Case: After the test-catalog router selects a technique for a behavior in your T-ID ledger, apply this Skill to write the actual vitest test body with step-by-step procedures and completion checklists. ## Quick Start Ask the AI to structure a vitest test for a specific behavior using the AAA pattern with a one-line Act and single assertion.

Frequently Asked Questions about test-structure-anatomy

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

FAQPage Schema
How do I structure a unit test with the AAA pattern?

Divide the test body into Arrange, Act, and Assert blocks separated by blank lines. Keep Act to a single call, limit Assert to one concern, and include only setup that affects the result. Verify the test fails on the intended line by temporarily breaking the expectation.

What is the difference between AAA and Given-When-Then?

They are structurally identical three-stage patterns. Given-When-Then uses business vocabulary (precondition, operation, result) suited to acceptance tests and Gherkin scenarios, while AAA uses technical vocabulary for general unit tests.

How do I write parameterized tests in vitest with it.each?

Build a cases array of input, expected value, and label rows, then pass it to it.each with dynamic placeholders like $partition and $value in the test name. Keep one shared assertion expression and hardcode expected values rather than computing them.

When should I split a table-driven test into multiple tables?

Split the table when the verification differs per row, such as mixing value checks with exception checks. Branching logic like if statements inside an it.each callback signals the table actually contains multiple behaviors and violates one-test-one-behavior.

Why should a test assert only one behavior?

Multiple unrelated assertions make one test span several behaviors, breaking the one-to-one mapping between tests and ledger entries. This makes coverage uncountable and failure diagnosis ambiguous, so each test verifies exactly one behavior.