At PyConUK 2016 I spoke about the Arrange Act Assert pattern and how it can help clean up unit tests.
Note: A newer post Arrange Act Assert pattern for Python developers is available. It has much clearer examples and guidelines for using AAA than the video and slides below.
PyConUK ask that we provide an explanation of why we think that attendees will be interested in our talk. This was my original proposal’s reasoning.
This talk focuses on developers that practise TDD, or want to use it more in their coding.
My assumption is that our community feels a lot of pain from testing. I’ve heard fellow developers talk about the difficulty with managing complicated test suites; issues with reading and understanding others’ tests; and struggles when updating others’ tests. I hope that the PyConUK attendees will have felt some of this pain be interested in a talk that demonstrates the use of a pattern that can (hopefully) mitigate some of it and help us all to be “cleaner” testers.
Although I’ve marked “moderately experienced” I think that my talk would have a broad appeal: Those who are new to testing and would like a “template” to follow. And those who are expert because of the discussion about when to DRY out tests and how to assert that our test refactors are safe.
Slides and video
The video of the talk does not capture much of the screen, so the slides are posted here too.
Kent Beck: Test Driven Development: By Example - a great book which references the AAA pattern (page 97).
Google-style docstrings: In addition to using this style in my AAA tests, I’ve started to add a Trusts section to indicate which other tests are trusted by any particular test and why.
Bill Wake’s post about AAA: Bill Wake is cited by Kent Beck as having coined the term 3A.
Update August 2018: Check out flake8-aaa - a Flake8 plugin that makes it easier to write tests that follow the Arrange Act Assert pattern.
Thanks again to Carles for introducing me to the AAA pattern.