This guide explains how to test the FindMinDisc AI chatbot to ensure all functionality works correctly.
The FindMinDisc chatbot has three levels of testing:
- File:
test_app.py - Tests: 54 tests covering core functionality
- Run Time: ~5-10 seconds
- Coverage:
- Database loading and validation
- Flight number correction
- Speed range filtering
- Disc type detection
- Flight path generation
- Knowledge base integration
- Retailers integration
- File:
test_handle_free_form.py - Tests: 3 integration tests
- Run Time: ~30-60 seconds
- Coverage:
- Speed range queries
- "Tell me more" queries
- Beginner recommendations
- File:
test_ai_responses.py - Tests: 20+ AI response tests
- Run Time: ~5-10 minutes
- Coverage:
- Speed range enforcement
- Flight number accuracy
- Understable/overstable detection
- Beginner recommendations
- Wind disc recommendations
- Manufacturer name correction
- Danish language responses
python test_app.pyThis runs all basic tests without requiring an OpenAI API key.
Expected Output:
✅ All tests passed!
Total: 54 passed, 0 failed, 0 warnings
To run the AI tests, you need an OpenAI API key:
Windows (PowerShell):
$env:OPENAI_API_KEY = 'your-api-key-here'
python test_handle_free_form.py
python test_ai_responses.pyLinux/Mac:
export OPENAI_API_KEY='your-api-key-here'
python test_handle_free_form.py
python test_ai_responses.pyUse the provided test runner:
python run_all_tests.pyThis will:
- Run basic tests first
- Check if OpenAI API key is available
- Run AI tests if key is present
- Generate a comprehensive test report
The test passed successfully. The chatbot behaves as expected.
The test failed. This indicates a bug or incorrect behavior that needs fixing.
A warning indicates optional features that are missing or sub-optimal behavior that doesn't break core functionality.
- Database Loading: Ensures disc databases load correctly
- Flight Numbers: Validates key discs have correct speed/glide/turn/fade
- Flight Number Correction: Tests AI response post-processing
- Speed Filtering: Ensures discs outside requested speed range are filtered
- Pattern Detection: Tests detection of disc types, speed ranges, and "tell me more" patterns
- Flight Path Data: Validates flight simulation data exists
- Knowledge Base: Checks Reddit data and FAISS index
- Integrations: Tests retailers and flight chart modules
- Syntax: Ensures app.py has no syntax errors
- Speed Range Query: Tests "7-9 speed disc" queries
- Tell Me More: Tests detailed disc information requests
- Beginner Recommendations: Tests putter recommendations for beginners
- Speed Range 7-9: Fairway drivers only
- Speed Range 10-14: Distance drivers only
- Tell Me More Database: Correct flight numbers from database
- Roadrunner Flight: Specific disc accuracy (9/5/-4/1)
- Volt Flight: Specific disc accuracy (8/5/-0.5/2)
- Putter Speed: Only 1-3 speed discs for putters
- Midrange Speed: Only 4-6 speed discs for midrange
- Understable Detection: Negative turn values
- Overstable Detection: Positive turn or high fade
- Flight Number Correction: AI hallucination fixes
- Beginner Recommendations: Understable, low-speed discs
- Wind Disc Recommendations: Overstable discs for wind
- Hyzer Flip Recommendations: Understable discs
- Approach Discs: Short-range putters/midrange
- Multiple Disc Requests: 2-3 recommendations
- Specific Manufacturer: Brand-specific queries
- Straight Flying: Neutral flight numbers
- Max Distance: High-speed drivers
- Speed Filter Testing: Post-processing validation
- Danish Language: Response in Danish
Solution: Set your OpenAI API key as an environment variable before running AI tests.
Solution: Install dependencies: pip install -r requirements.txt
Solution: Ensure you're running tests from the repository root directory.
Solution: AI tests make real API calls and can take several minutes. This is expected behavior.
Solution: AI responses can vary slightly between runs. A few intermittent failures in AI tests are expected due to the stochastic nature of LLMs. The post-processing logic (flight number correction, speed filtering) should catch most issues.
| Component | Test Coverage | Notes |
|---|---|---|
| Database Loading | ✅ Comprehensive | All disc data validated |
| Flight Number Accuracy | ✅ Comprehensive | Post-processing ensures correctness |
| Speed Range Filtering | ✅ Comprehensive | Both detection and enforcement |
| Disc Type Detection | ✅ Comprehensive | Putter/Midrange/Fairway/Distance |
| AI Recommendations | ✅ Extensive | 20+ test scenarios |
| Flight Path Generation | ✅ Good | Basic validation |
| Knowledge Base | ✅ Good | Reddit data integration |
| Retailers | ✅ Basic | Link generation tested |
| UI/Streamlit | Requires manual testing |
While automated tests cover most functionality, some features require manual testing:
- Run the Streamlit app:
streamlit run app.py - Test flight chart visualization
- Test retailer links open correctly
- Test "Tell me more" conversation flow
- Test flight path animations
- Test responsive design on mobile
- Test all language (Danish) rendering correctly
- Test error handling with invalid inputs
To ensure ongoing quality:
- Run
python test_app.pybefore every commit - Run full AI tests before major releases
- Add new test cases when bugs are discovered
- Update expected values when database is updated
When adding new discs or features:
- Update
disc_database.jsonwith accurate flight numbers - Add test cases for new disc types or features
- Verify AI responses include new discs appropriately
- Update this documentation with new test procedures
If tests fail unexpectedly:
- Check the detailed error messages
- Verify your environment setup (Python version, dependencies)
- Ensure databases are up-to-date
- Review recent code changes
- Check OpenAI API status if AI tests fail
Last Updated: 2026-02-03 Test Suite Version: 1.0