Assemble Activate Assert

"Assemble-Activate-Assert": is the pattern that all UnitTest cases follow, so arranging, naming, and formatting code to reflect the pattern is a good idea:

All TestCases...
  1. Assemble the data resources they intend to use.
  2. Activate a target method. -- sometimes referred to as "TheMoneyLine"
  3. Assert that some side-effect, from that method, is within tolerance.

ToDo: See ArrangeActAssert (and consider condensing!)


All TestCases follow some variation of this pattern:

  def test_case
    a = assemble()
    q = a.activate(41)
    assert{ q == 42 }
  end

All TestCases first Assemble the data resources they intend to use.

Then they Activate a target method. (Preferrably the one you name your real test case after!)

Then they Assert that some side-effect, from that method, is within tolerance.


AssembleActivateAssert seems to be used primarily in the RubyLanguage community. The ArrangeActAssert term seems to be more popular in the JavaLanguage community.


I might say that AssembleActivateAssert/ArrangeActAssert is a pattern that test cases should follow.

I've certainly seen and even tests that don't follow these patterns. The tests might be improved by following the AAA pattern, but they did work and were automated tests, even without following the AAA pattern.

Specific deviations I've seen are... -- JeffGrigg

For any test case you can show me, worth the name, no matter how defactored or scripted or behaviorized it may be, I can point to its Assemble, its Activation, and its Assertion.

It's not "should follow", it's "defines". --PhlIp


Also known as: ArrangeActAssert

EditText of this page (last edited February 26, 2009) or FindPage with title or text search