Arrange, Act, Assert

noun

say it: “uh-RAYNJ AKT uh-SERT” /əˈreɪndʒ ækt əˈsɜːrt/

A three-part shape for a test: set things up, do the one action, then check the result.

What is Arrange, Act, Assert?

Arrange, Act, Assert is the standard shape of a test: set things up, do the one action, check the result.

[Fact]
public void Deposit_AddsToBalance()
{
    var account = new Account();   // Arrange
    account.Deposit(50);            // Act
    Assert.Equal(50, account.Balance); // Assert
}

In a sentence

  • “Each test follows Arrange, Act, Assert, with a blank line between the parts.”

Level: Novice · More Unit Testing terms at this level

Updated