# Test Aaa Structure

> Apply Arrange-Act-Assert pattern for clear tests

- Skill: `snoodleboot-io/test-aaa-structure-2` (Agent Skill)
- Install (CLI): `npx get-skill add snoodleboot-io/test-aaa-structure-2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/snoodleboot-io/test-aaa-structure-2/raw
- Safety review: pending (external: skill-scanner PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: snoodleboot-io (https://skillmd.com/u/snoodleboot-io)
- Updated: 2026-11-15
- Page: https://skillmd.com/skills/snoodleboot-io/test-aaa-structure-2

---


## Instructions

Structure tests using **Arrange-Act-Assert** (AAA):

1. **Arrange:** Set up state and inputs
2. **Act:** Call the function/method under test
3. **Assert:** Verify outputs and side effects

### Key Rules

- One logical assertion per test
- Descriptive test names (read like sentences)
- Separate AAA sections with blank lines or comments

### Example

```python
def test_get_user_returns_user_when_found():
    # Arrange
    user = User(id="123", name="Alice")
    db.save(user)
    
    # Act
    result = get_user_by_id("123")
    
    # Assert
    assert result.name == "Alice"
```



