django-tdd
Master test-driven development for Django projects using pytest and factory_boy to build reliable models, views, and APIs. This skill covers the red-green-refactor cycle, test fixtures, factory patterns, and Django REST Framework testing.
django-tdd teaches test-driven development methodology for Django applications using pytest and factory_boy.
AI-generated summary based on this skill's SKILL.md
Decision gist · record as of 2026-07-27
django-tdd teaches test-driven development methodology for Django applications using pytest and factory_boy. Master test-driven development for Django projects using pytest and factory_boy to build reliable models, views, and APIs. This skill covers the red-green-refactor cycle, test fixtures, factory patterns, and Django REST Framework testing.
Use it when
- django-tdd guides you through configuring pytest and factory_boy specifically for Django model and API testing.
- django-tdd covers comprehensive testing strategies for Django REST Framework, including how to test serializers, viewsets, and endpoints.
Verify before relying
Read SKILL.md below before installing (1 file). Open directory: indexed for reading, not audited.
Install
affaan-m/ECC/django-tdd · repository language: JavaScript
Open directory. Skills are indexed for reading, not audited. Review a skill's body before installing it.
Frequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
What is django-tdd and how does it help with Django testing?
django-tdd is a comprehensive skill for mastering test-driven development in Django projects. It teaches you to use pytest and factory_boy to build reliable models, views, and APIs through the red-green-refactor cycle. The skill covers test fixtures, factory patterns, and Django REST Framework testing, enabling you to write robust tests before implementing features.
How do I set up pytest and factory_boy for Django model testing?
django-tdd guides you through configuring pytest and factory_boy specifically for Django model and API testing. You'll learn to create test factories that generate model instances efficiently, set up pytest fixtures for reusable test data, and organize your test suite. This setup ensures consistent, maintainable tests across your Django projects.
What does django-tdd teach about testing Django REST Framework APIs?
django-tdd covers comprehensive testing strategies for Django REST Framework, including how to test serializers, viewsets, and endpoints. You'll learn to use Django's test client to make API requests, validate responses, and test authentication and permissions. The skill emphasizes testing complete request-response cycles to ensure your API behaves correctly.
How can I test Django REST API endpoints with django-tdd?
django-tdd teaches you to test Django REST API endpoints using pytest fixtures, factory_boy for test data, and Django's API test client. You'll learn to structure tests for different HTTP methods, validate serializer output, and test viewset actions. The skill includes patterns for testing authentication, permissions, and error responses in your REST APIs.
Does django-tdd cover mocking and test coverage measurement?
Yes, django-tdd addresses mocking external services and measuring test coverage in Django projects. You'll learn to mock third-party APIs, database calls, and other dependencies to isolate your tests. The skill also covers setting up coverage tools to track which parts of your codebase are tested, helping you identify gaps.
What is the red-green-refactor cycle taught in django-tdd?
django-tdd teaches the red-green-refactor cycle, the core of test-driven development. You write a failing test (red), implement code to make it pass (green), then improve the code without breaking tests (refactor). This methodology, combined with pytest fixtures and factory patterns, ensures your Django applications are well-tested and maintainable from the start.
SKILL.md
Rendered from the published skill. Quoted content, verbatim.
Django Testing with TDD
Test-driven development for Django applications using pytest, factory_boy, and Django REST Framework.
When to Activate
- Writing new Django applications
- Implementing Django REST Framework APIs
- Testing Django models, views, and serializers
- Setting up testing infrastructure for Django projects
TDD Workflow for Django
Red-Green-Refactor Cycle
# Step 1: RED - Write failing test
def test_user_creation():
user = User.objects.create_user(email='test@example.com', password='testpass123')
assert user.email == 'test@example.com'
assert user.check_password('testpass123')
assert not user.is_staff
# Step 2: GREEN - Make test pass
# Create User model or factory
# Step 3: REFACTOR - Improve while keeping tests green
Setup
pytest Configuration
```ini
pytest.ini
[pytest] DJANGO_SETTINGS_MODULE = config.settings.test testpaths = tests python_files = test_.py python_classes = Test python_functions =
(truncated - see the full file via the links below)
File tree — 1 file
skills/django-tdd/SKILL.md
Let your AI agent find skills like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 56,283 agent skills by what they can do, searchable in plain language.
wish › “Learn test-driven development methodology for Django applications”
Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →
Related skills
Learn test-driven development for Django applications using pytest and factory_boy. This skill covers the red-green-refactor workflow, test configuration, fixture setup, and testing Django models, views, and REST Framework APIs with practical examples.
Pytest Patterns teaches structured testing for Python backends using pytest, httpx, and factory_boy. Learn to organize tests across unit and integration layers, build reusable fixtures with proper scoping, seed test data with factories, and test async FastAPI endpoints. Covers mocking, parametrization, and conftest hierarchy—but skips frontend and E2E testing.
Learn proven Django REST Framework patterns for building scalable APIs. This skill covers ViewSets, Serializers for different operations, filtering strategies, custom permissions, pagination setup, and routing conventions. Includes testing patterns and common management commands.
pytest is Python's standard testing framework, enabling developers to write organized unit and integration tests through fixtures for dependency injection and parametrization for data-driven test cases. It supports async code, multiple test discovery patterns, and integrates seamlessly with FastAPI, Django, and Flask, plus a rich plugin ecosystem for coverage, mocking, and parallel execution.
Pytest Patterns teaches you to write reliable Python tests using pytest's core features—fixtures for setup and teardown, parametrization to run tests with multiple inputs, and mocking to isolate dependencies. Learn test organization, coverage analysis, and CI/CD integration to scale from simple unit tests to complex test suites.
Learn to build robust Python tests using pytest with test-driven development principles. This skill covers fixtures for setup and teardown, parametrization for running tests across multiple inputs, mocking to isolate dependencies, and achieving meaningful code coverage targets.
More skills Pytest Async Testing (unlicensed)