- Updated migration files to remove references to the old `companies` app and replace them with new app dependencies (`operators` and `manufacturers`). - Fixed foreign key references in migration files to point to the correct models in the new apps. - Updated import statements in management commands and test files to reflect the new app structure. - Completed a thorough validation of the migration system to ensure full functionality and operational status.
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:
python tests/test_runner.py
This will:
- Run all tests across all apps
- Generate a coverage report in the terminal
- Create a detailed HTML coverage report in
tests/coverage_html/
Viewing Coverage Reports
There are two ways to view the coverage reports:
-
Terminal Report: Shows a quick overview of test coverage directly in your terminal after running the tests.
-
HTML Report: A detailed, interactive report showing line-by-line coverage that can be accessed in two ways:
- Directly open
tests/coverage_html/index.htmlin your browser - Visit
http://localhost:8000/coverage/when running the development server (only available in DEBUG mode)
- Directly open
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 functionalitycompanies/tests.py: Tests for company and manufacturer modelslocation/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:
- All new code is covered by tests
- Tests follow the existing pattern in related test files
- Both positive and negative test cases are included
- 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:
- Check the error message and stack trace
- Verify test database settings
- Ensure all required dependencies are installed
- 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 runserverto access the coverage reports athttp://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