Spaces:
Running
Running
PromptAid Vision Test Suite
This directory contains comprehensive tests for the PromptAid Vision application, organized into two main categories.
π§ͺ Test Structure
π Unit Tests (unit_tests/
)
Tests for individual components and functions in isolation:
test_basic.py
- Basic Python and unittest setup verificationtest_schema_validator.py
- Schema validation service teststest_image_preprocessor.py
- Image preprocessing service teststest_vlm_service.py
- VLM service manager and stub service tests
π Integration Tests (integration_tests/
)
Tests for component interactions, API endpoints, and workflows:
test_upload_flow.py
- Complete upload workflow with database and APItest_schema_validation.py
- Schema validation integration teststest_admin_endpoints.py
- Admin authentication and model managementtest_explore_page.py
- Frontend explore page functionalitytest_openai_integration.py
- OpenAI API integration teststest_config.py
- Configuration and storage system teststest_core.py
- Core application functionality teststest_crisis_analysis_workflow.py
- Crisis analysis workflow integration teststest_admin_management_workflow.py
- Admin management workflow integration teststest_data_export_workflow.py
- Data export workflow integration tests
π Running Tests
Run All Tests
cd py_backend
python tests/run_tests.py
Run Specific Test Categories
# Unit tests only
python tests/unit_tests/run_unit_tests.py
# Integration tests only
python tests/integration_tests/run_integration_tests.py
Run Individual Test Files
cd py_backend
python tests/unit_tests/test_schema_validator.py
python tests/integration_tests/test_upload_flow.py
π Test Categories Summary
Category | Count | Purpose | Location |
---|---|---|---|
Unit Tests | 4 | Test individual components | unit_tests/ |
Integration Tests | 10 | Test component interactions and workflows | integration_tests/ |
Total | 14 | Comprehensive test coverage | tests/ |
π§ Test Environment
- Backend: FastAPI application with PostgreSQL database
- Frontend: React application with IFRC UI components
- APIs: OpenAI, HuggingFace, and custom VLM services
- Validation: JSON schema validation for crisis maps and drone images
π Test Results
Tests provide detailed output including:
- β Success indicators for passed tests
- β Error details for failed tests
- π Metadata about test execution
- β±οΈ Performance timing information
- π Detailed validation results
π¨ Troubleshooting
Common Issues
- Import Errors: Ensure you're running from the
py_backend
directory - Database Connection: Verify PostgreSQL is running and accessible
- API Keys: Check environment variables for required API keys
- Backend Status: Ensure FastAPI backend is running on expected port
Test Configuration
- Set
ADMIN_PASSWORD
environment variable for admin endpoint tests - Ensure backend is running on
localhost:8000
for integration tests - Update
BASE_URL
in test files if using different backend URL
Getting Help
- Check test output for specific error messages
- Verify environment configuration
- Ensure all dependencies are installed
- Check backend logs for additional context