layout | title | folder | permalink | categories | tags | |
---|---|---|---|---|---|---|
pattern |
Arrange/Act/Assert |
arrange-act-assert |
/patterns/arrange-act-assert/ |
Idiom |
|
Given/When/Then
The Arrange/Act/Assert (AAA) is a pattern for organizing unit tests. It breaks tests down into three clear and distinct steps:
- Arrange: Perform the setup and initialization required for the test.
- Act: Take action(s) required for the test.
- Assert: Verify the outcome(s) of the test.
Use Arrange/Act/Assert pattern when
- you need to structure your unit tests so they're easier to read, maintain, and enhance.