Turning test writing into a consistently brief and pleasant experience

This video features Wilhelm Klopp at DjangoCon Europe 2023 in Edinburgh.

0:34:53
Published June 7, 2023
1,661 views

Writing tests for our web apps can be painful, slow, and boring. In this talk we look at 10 tools and techniques to make writing django tests a consistently pleasant experience.

There's one thing I enjoy least about software development: Writing tests. I appreciate the tests I've written in the past, but I do not enjoy the process of creating new ones. How can we make test writing a pleasant, brief, and fun experience? This talk looks at over 10 tools and techniques to accomplish exactly that.

  • Engage the audience with some live poll questions:

    • How much time do you spend writing tests?
    • How much do you enjoy writing tests?
    • Have you spent time improving your own testing experience?
  • What existing software engineering research says about how much time we spend on tests

  • How we think about writing tests for our web applications:

    • What value do we get from tests, why do we write them at all?
    • How many tests should we write? What do we not want to test? How important is coverage?
    • What tests should we write? Unit tests, integration tests, Not too many, mostly integration
    • When does test driven development help us? When does it not?
  • Techniques for making test writing more brief and more pleasant:

    • Putting in some time to write testing abstractions to improve the testing experience of your colleagues and future you
    • Testing utilities for managing time: freezegun, time machine
    • Testing utilities for dealing with outbound http requests: httpretty, response, VCR
    • Testing utilities for managing with SQL queries
    • Property based testing and ghostwriting with hypothesis
    • Kolo to turn recorded requests into tests
    • Pytest and the best plugins for saving time
    • Browser based testing: Selenium, storybook, etc.
    • Generating tests with large language models – How useful is Chat GPT?
    • Further tools and techniques from user interviews with django developers (this research is ongoing)
      • I’m in the process of interviewing ~20 django developers about their experience with writing tests and the steps the’ve taken to improve their test setup. I plan to incorporate many of the learnings in this talk
  • Summary, Recap, Conclusion Attendees will come away with practical tips for how to improve their own experience writing tests.

Presenters

Note: We understand that names change, people change, and bodies change. We respect each individual's journey and privacy. If you have any concerns about a video or need us to remove content, please don't hesitate to contact us. We will handle your request with care and promptly address any issues.

More videos by Wilhelm Klopp

More videos from DjangoCon Europe