DjangoCon 2022 | Quality Assurance in Django - Testing what matters

Learn quality assurance best practices for Django applications, including user journey analysis, automation, and testing strategies, with a focus on efficient and effective testing.

Key takeaways
  • Start with user journeys and user flows: When approaching quality assurance, start by identifying user journeys and user flows to determine where to focus testing efforts.
  • Automate tasks: Use automation frameworks to reduce the amount of busy work and allow for more efficient testing.
  • Context matters: Understand the context of the project and the testing goals to determine the most effective testing strategy.
  • Testing pyramid: Use the testing pyramid as a guide, with most tests being unit tests, some integration tests, and a few end-to-end tests.
  • De-inflate and re-inflate: Zoom in and out of different levels of complexity to get a good balance between unit tests and integration tests.
  • Focus on user interactions: Test how users interact with the application, rather than just testing individual components.
  • Test frameworks and abstractions: Test framework code and abstractions, as well as business logic code, to ensure they work as expected.
  • Context managers and utility classes: Use context managers and utility classes to simplify testing and make it more efficient.
  • Don’t just write tests, think about what you’re testing: Make sure you know what you’re testing and why, rather than just writing tests for the sake of writing tests.
  • Use assertions: Use assertions to ensure that the expected behavior is occurring, and to catch errors quickly.
  • Test entities and functionality: Test entities and functionality, rather than just individual components, to ensure that the entire system works as expected.
  • Integrate testing into development: Integrate testing into the development process, rather than treating it as an afterthought.
  • Have a strategy for testing: Have a clear strategy for testing and testing goals, rather than just writing tests without a plan.
  • Regression testing is important: Regression testing is important to ensure that changes do not introduce new bugs or break existing functionality.
  • Use tools like Django test automation framework: Use tools like Django’s test automation framework to simplify testing and make it more efficient.