mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 12:11:13 -05:00
85 lines
2.7 KiB
Markdown
85 lines
2.7 KiB
Markdown
# ThrillWiki Test Suite
|
|
|
|
This directory contains the comprehensive test suite for ThrillWiki, including unit tests and integration tests for all major components of the system.
|
|
|
|
## Running Tests
|
|
|
|
To run the complete test suite with coverage reporting:
|
|
|
|
```bash
|
|
python tests/test_runner.py
|
|
```
|
|
|
|
This will:
|
|
1. Run all tests across all apps
|
|
2. Generate a coverage report in the terminal
|
|
3. Create a detailed HTML coverage report in `tests/coverage_html/`
|
|
|
|
## Viewing Coverage Reports
|
|
|
|
There are two ways to view the coverage reports:
|
|
|
|
1. Terminal Report: Shows a quick overview of test coverage directly in your terminal after running the tests.
|
|
|
|
2. HTML Report: A detailed, interactive report showing line-by-line coverage that can be accessed in two ways:
|
|
- Directly open `tests/coverage_html/index.html` in your browser
|
|
- Visit `http://localhost:8000/coverage/` when running the development server (only available in DEBUG mode)
|
|
|
|
The HTML report provides:
|
|
- Line-by-line coverage analysis
|
|
- Branch coverage information
|
|
- Missing lines highlighting
|
|
- Interactive file browser
|
|
- Detailed statistics per module
|
|
|
|
## Test Structure
|
|
|
|
The test suite is organized by app, with each app having its own test file:
|
|
|
|
- `parks/tests.py`: Tests for park-related functionality
|
|
- `companies/tests.py`: Tests for company and manufacturer models
|
|
- `location/tests.py`: Tests for location functionality and GeoDjango features
|
|
- Additional test files in other app directories
|
|
|
|
## Writing New Tests
|
|
|
|
When adding new features or modifying existing ones, please ensure:
|
|
|
|
1. All new code is covered by tests
|
|
2. Tests follow the existing pattern in related test files
|
|
3. Both positive and negative test cases are included
|
|
4. Edge cases are considered and tested
|
|
|
|
## Test Categories
|
|
|
|
The test suite includes:
|
|
|
|
- Model Tests: Verify model creation, validation, and methods
|
|
- View Tests: Test view responses and template rendering
|
|
- Form Tests: Validate form processing and validation
|
|
- Integration Tests: Test interactions between components
|
|
|
|
## Continuous Integration
|
|
|
|
These tests are run automatically on:
|
|
- Pull request creation
|
|
- Merges to main branch
|
|
- Release tagging
|
|
|
|
## Troubleshooting
|
|
|
|
If tests fail:
|
|
1. Check the error message and stack trace
|
|
2. Verify test database settings
|
|
3. Ensure all required dependencies are installed
|
|
4. Check for any pending migrations
|
|
|
|
For any issues, please create a ticket in the issue tracker.
|
|
|
|
## Development Tips
|
|
|
|
- Run the development server with `python manage.py runserver` to access the coverage reports at `http://localhost:8000/coverage/`
|
|
- Coverage reports are only served in development mode (when DEBUG=True)
|
|
- The coverage directory is automatically created when running tests
|
|
- Reports are updated each time you run the test suite
|