At PyConUK 2016 I spoke about the Arrange Act Assert pattern and how it can help clean up unit tests. I plan to write a short guide to AAA for Python developers and will link to that from here when done - meanwhile, below are my slides and links to some of the resources that have helped me.
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.
- PEP08 and PEP20.
- 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.
- Extract Method: I’ve used extract method as defined by Martin Fowler. See also Extract Variable.