Add overview section to testing, referring to DjangoCon 2022 talk

This commit is contained in:
Radoslav Georgiev 2022-11-03 09:25:14 +02:00
parent e76d5a8b27
commit 6fca761f31
No known key found for this signature in database
GPG Key ID: 0B7753A4DFCE646D

View File

@ -19,59 +19,60 @@
- [Why not?](#why-not) - [Why not?](#why-not)
- [Cookie Cutter](#cookie-cutter) - [Cookie Cutter](#cookie-cutter)
- [Models](#models) - [Models](#models)
- [Base model](#base-model) * [Base model](#base-model)
- [Validation - `clean` and `full_clean`](#validation---clean-and-full_clean) * [Validation - `clean` and `full_clean`](#validation---clean-and-full_clean)
- [Validation - constraints](#validation---constraints) * [Validation - constraints](#validation---constraints)
- [Properties](#properties) * [Properties](#properties)
- [Methods](#methods) * [Methods](#methods)
- [Testing](#testing) * [Testing](#testing)
- [Services](#services) - [Services](#services)
- [Example - function-based service](#example---function-based-service) * [Example - function-based service](#example---function-based-service)
- [Example - class-based service](#example---class-based-service) * [Example - class-based service](#example---class-based-service)
- [Naming convention](#naming-convention) * [Naming convention](#naming-convention)
- [Modules](#modules) * [Modules](#modules)
- [Selectors](#selectors) * [Selectors](#selectors)
- [Testing](#testing-1) * [Testing](#testing-1)
- [APIs & Serializers](#apis--serializers) - [APIs & Serializers](#apis--serializers)
- [Naming convention](#naming-convention-1) * [Naming convention](#naming-convention-1)
- [Class-based vs. Function-based](#class-based-vs-function-based) * [Class-based vs. Function-based](#class-based-vs-function-based)
- [List APIs](#list-apis) * [List APIs](#list-apis)
- [Plain](#plain) + [Plain](#plain)
- [Filters + Pagination](#filters--pagination) + [Filters + Pagination](#filters--pagination)
- [Detail API](#detail-api) * [Detail API](#detail-api)
- [Create API](#create-api) * [Create API](#create-api)
- [Update API](#update-api) * [Update API](#update-api)
- [Fetching objects](#fetching-objects) * [Fetching objects](#fetching-objects)
- [Nested serializers](#nested-serializers) * [Nested serializers](#nested-serializers)
- [Advanced serialization](#advanced-serialization) * [Advanced serialization](#advanced-serialization)
- [Urls](#urls) - [Urls](#urls)
- [Settings](#settings) - [Settings](#settings)
- [Prefixing environment variables with `DJANGO_`](#prefixing-environment-variables-with-django_) * [Prefixing environment variables with `DJANGO_`](#prefixing-environment-variables-with-django_)
- [Integrations](#integrations) * [Integrations](#integrations)
- [Reading from `.env`](#reading-from-env) * [Reading from `.env`](#reading-from-env)
- [Errors & Exception Handling](#errors--exception-handling) - [Errors & Exception Handling](#errors--exception-handling)
- [How exception handling works (in the context of DRF)](#how-exception-handling-works-in-the-context-of-drf) * [How exception handling works (in the context of DRF)](#how-exception-handling-works-in-the-context-of-drf)
- [DRF's `ValidationError`](#drfs-validationerror) + [DRF's `ValidationError`](#drfs-validationerror)
- [Django's `ValidationError`](#djangos-validationerror) + [Django's `ValidationError`](#djangos-validationerror)
- [Describe how your API errors are going to look like.](#describe-how-your-api-errors-are-going-to-look-like) * [Describe how your API errors are going to look like.](#describe-how-your-api-errors-are-going-to-look-like)
- [Know how to change the default exception handling behavior.](#know-how-to-change-the-default-exception-handling-behavior) * [Know how to change the default exception handling behavior.](#know-how-to-change-the-default-exception-handling-behavior)
- [Approach 1 - Use DRF's default exceptions, with very little modifications.](#approach-1---use-drfs-default-exceptions-with-very-little-modifications) * [Approach 1 - Use DRF's default exceptions, with very little modifications.](#approach-1---use-drfs-default-exceptions-with-very-little-modifications)
- [Approach 2 - HackSoft's proposed way](#approach-2---hacksofts-proposed-way) * [Approach 2 - HackSoft's proposed way](#approach-2---hacksofts-proposed-way)
- [More ideas](#more-ideas) * [More ideas](#more-ideas)
- [Testing](#testing-2) - [Testing](#testing-2)
- [Naming conventions](#naming-conventions) * [Overview](#overview-1)
- [Factories](#factories) * [Naming conventions](#naming-conventions)
* [Factories](#factories)
- [Celery](#celery) - [Celery](#celery)
- [The basics](#the-basics) * [The basics](#the-basics)
- [Error handling](#error-handling) * [Error handling](#error-handling)
- [Configuration](#configuration) * [Configuration](#configuration)
- [Structure](#structure) * [Structure](#structure)
- [Periodic Tasks](#periodic-tasks) * [Periodic Tasks](#periodic-tasks)
- [Beyond](#beyond) * [Beyond](#beyond)
- [Cookbook](#cookbook) - [Cookbook](#cookbook)
- [Handling updates with a service](#handling-updates-with-a-service) * [Handling updates with a service](#handling-updates-with-a-service)
- [DX (Developer Experience)](#dx-developer-experience) - [DX (Developer Experience)](#dx-developer-experience)
- [`mypy` / type annotations](#mypy--type-annotations) * [`mypy` / type annotations](#mypy--type-annotations)
- [Django Styleguide in the Wild](#django-styleguide-in-the-wild) - [Django Styleguide in the Wild](#django-styleguide-in-the-wild)
- [Additional resources](#additional-resources) - [Additional resources](#additional-resources)
- [Inspiration](#inspiration) - [Inspiration](#inspiration)
@ -2342,6 +2343,14 @@ You can even handle all exceptions, but then, you should be sure those exception
## Testing ## Testing
### Overview
Testing is an interesting & vast topic.
As an overview, you can listen to [Radoslav Georgiev's talk at DjangoCon Europe 2022](https://www.youtube.com/watch?v=PChaEAIsQls):
[![Quality Assurance in Django - Testing what matters](https://img.youtube.com/vi/PChaEAIsQls/0.jpg)](https://www.youtube.com/watch?v=PChaEAIsQls)
In our Django projects, we split our tests depending on the type of code they represent. In our Django projects, we split our tests depending on the type of code they represent.
Meaning, we generally have tests for models, services, selectors & APIs / views. Meaning, we generally have tests for models, services, selectors & APIs / views.