Files
metaverseDubai/scripts/tests/README.md
2026-07-07 03:43:19 -07:00

77 lines
1.7 KiB
Markdown

# Scripts Tests Directory
## Overview
This directory contains tests for automation scripts in the Dubai Metaverse project.
## Test Structure
### Unit Tests
- Test individual script functions
- Validate input/output
- Test error handling
### Integration Tests
- Test script interactions
- Validate end-to-end workflows
- Test script dependencies
### Validation Tests
- Test script correctness
- Validate script standards compliance
- Check script documentation
## Running Tests
```bash
# Run all tests
make test
# Run specific test
python3 -m pytest tests/test_script_name.py
# Run with coverage
python3 -m pytest --cov=scripts tests/
```
## Test Files
- `test_setup_scripts.py` - Tests for setup scripts
- `test_validation_scripts.py` - Tests for validation scripts
- `test_data_scripts.py` - Tests for data processing scripts
- `test_build_scripts.py` - Tests for build scripts
## Writing Tests
Follow these guidelines:
1. **Test one thing at a time**
2. **Use descriptive test names**
3. **Test both success and failure cases**
4. **Mock external dependencies**
5. **Keep tests fast and isolated**
## Example Test
```python
import unittest
from scripts.setup_project import validate_prerequisites
class TestSetupProject(unittest.TestCase):
def test_validate_prerequisites_success(self):
"""Test that prerequisites validation passes with all requirements"""
result = validate_prerequisites()
self.assertTrue(result)
def test_validate_prerequisites_missing_git(self):
"""Test that validation fails when Git is missing"""
# Mock missing git
# ...
with self.assertRaises(SystemExit):
validate_prerequisites()
```
---
**Last Updated**: 2024