# Unit tests ## AAA pattern Testing is clearer and easier to maintain with the Arrange, Act, Assert (AAA) pattern: - **Arrange:** Prepare everything needed for the test, such as data, test doubles, or environment setup. Use fixtures to handle repetitive setup. Skip if nothing needs preparing. - **Act:** Perform a single action, like calling a function or method. Focus each test on only one main action. - **Assert:** Check expected outcomes with clear assertions. Multiple assertions are possible but remember: tests stop at the first failure, so independent checks may need separate tests. AAA structure organizes tests into a clear beginning, middle, and end. It helps each test tell a small, understandable story. Following this structure improves readability, simplifies debugging, and supports easier trust and maintenance as projects grow.