Daily iOS
Testing

Arrange-Act-Assert

Why do you split test code into Arrange-Act-Assert (Given-When-Then)?

How would an interviewer hear this answer? You'll see whether they'd move on, dig in, or say no, and which sentences would trip you up. Your score doesn't change.
See the short answer

AAA separates setup, execution, and verification into three blocks so a test shows at a glance what state it started in, what it did, and what should be true. The reader finds the cause of a failure right away, and two Acts is a signal to split the test.

Share a question