Skip to content

amirbigg/django-testing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧪 Django Testing Boilerplate

A practical, minimal Django project designed to showcase and demonstrate best practices for testing web applications built with the Django framework. This repository provides a ready-to-run environment with various types of tests configured to help developers understand, implement, and maintain high-quality testing in their own Django projects.


✨ Features

  • Comprehensive Test Suite: Examples of Unit Tests (for models, utility functions), Integration Tests (for views, serializers, forms), and Functional Tests (via Django's TestCase and TestClient).
  • Modern Tooling: Pre-configured for use with modern testing libraries like pytest (or the standard Django unittest runner).
  • Data Generation: Utilization of libraries like factory-boy for creating realistic and reusable test data fixtures.
  • API Testing: Demonstrations of testing API endpoints, including authentication and permission checks (if Django REST Framework is used).
  • CI/CD Ready: Configured for easy integration into Continuous Integration/Continuous Deployment pipelines.

🛠️ Technologies Used

Technology Purpose
Python The core programming language.
Django The web framework used.
pytest (Optional) A powerful testing framework.
factory-boy Generating model instances and data fixtures.

🚀 Getting Started

Follow these steps to get a local copy of the project up and running.

Prerequisites

  1. Python 3.x
  2. pip (Python package installer)

Installation

  1. Clone the repository:

    git clone [https://github.com/amirbigg/django-testing.git](https://github.com/amirbigg/django-testing.git)
    cd django-testing
  2. Create and activate a virtual environment (recommended):

    # For Linux/macOS
    python3 -m venv venv
    source venv/bin/activate
    
    # For Windows
    python -m venv venv
    .\venv\Scripts\activate
  3. Install dependencies:

    pip install -r requirements.txt
  4. Run migrations:

    python manage.py migrate
  5. Run the development server (optional):

    python manage.py runserver

📝 Running Tests

You can run the entire test suite using the standard Django test runner or, if configured, pytest.

Using the Default Django Test Runner

python manage.py test

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages