Contribute Media
A thank you to everyone who makes this possible: Read More

Design Your Tests

Summary

While getting started testing often provides noticeable immediate improvement for any developer, it's often not until the realization that tests are things that need design to provide maximal benefit that developers begin to appreciate or even enjoy them.

We'll investigate how building shallow, transparent layers for your tests makes for better failures, clearer tests, and quicker diagnoses.

Description

  • Life span of a test
    • 5 minute - why does this fail?
    • 5 day - what is this missing?
    • 5 week - do I have coverage for this?
    • 5 month - what's not causing this bug?
  • Transparent simplicity
    • one or two "iceberg" layers for meaning
      • Higher-order assertions - build collections of state that have meaning for the domain in the tests
      • bulk of the details are in the code itself
      • show an example
    • grouping for organization
      • Mixins
      • show an example
  • unittest issues
    • assertion/mixin clutter
    • setUp/tearDown tie grouping to the class layer or to inheritance via super
      • addCleanup
    • weak association / lookup-ability between code and its tests
      • package layout
      • other conventions
  • Alternative approaches
    • testtools' matchers
    • py.test assert magic

Details

Improve this page