Spaces:
Runtime error
Runtime error
File size: 4,057 Bytes
a428e27 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
# Testing Guide
## Quick Test
Run the automated test suite:
```bash
python tests/test_rag_system.py
```
Or with venv:
```bash
source venv/bin/activate
python tests/test_rag_system.py
```
## Manual Testing
### 1. Test Modal Connection
```bash
source venv/bin/activate
modal --version
```
Expected: Shows Modal version number
### 2. Test Indexing
```bash
source venv/bin/activate
python src/web/query_product_design.py --index
```
Expected:
- β
Loads Word/PDF/Excel files
- β
Creates embeddings
- β
Stores in ChromaDB
- β
Shows success message
**Time**: 2-5 minutes
### 3. Test Query (CLI)
```bash
source venv/bin/activate
python src/web/query_product_design.py --query "What are the three product tiers?"
```
Expected:
- β
Returns answer with product tier information
- β
Shows retrieval and generation times
- β
Lists sources
**Time**: 3-10 seconds (first query may be slower due to cold start)
### 4. Test Query (Interactive Mode)
```bash
source venv/bin/activate
python src/web/query_product_design.py --interactive
```
Then type questions like:
- "What are the three product tiers?"
- "What is the Year 3 premium volume?"
- "What coverage does the Standard tier include?"
### 5. Test Web Interface
```bash
source venv/bin/activate
python src/web/web_app.py
```
Then:
1. Open browser: `http://127.0.0.1:5000`
2. Enter a question
3. Click "Ask Question"
4. Verify answer appears
## Test Cases
### Product Information Queries
- β
"What are the three product tiers?"
- β
"What are the premium ranges for each tier?"
- β
"What coverage does the Standard tier include?"
- β
"What are the unique features of TokyoDrive Insurance?"
### Financial Queries
- β
"What is the Year 3 premium volume projection?"
- β
"What is the target loss ratio?"
- β
"What are the break-even projections?"
### Market & Strategy Queries
- β
"What is the target market size in Tokyo?"
- β
"Who are the main competitors?"
- β
"What are the key value propositions?"
### Compliance Queries
- β
"What are the FSA licensing requirements?"
- β
"What is the minimum capital requirement?"
- β
"What data privacy requirements apply?"
## Expected Behavior
### Successful Query
- Answer appears within 10-30 seconds
- Answer is relevant and accurate
- Sources are listed
- Timing information is shown
### Failed Query
- Clear error message
- Suggestion for fixing the issue
- No crash or hang
## Troubleshooting Tests
### "Modal command not found"
```bash
source venv/bin/activate
pip install modal
```
### "No documents found"
```bash
# Upload documents first
modal volume put mcp-hack-ins-products \
docs/product-design/tokyo_auto_insurance_product_design.docx \
docs/product-design/tokyo_auto_insurance_product_design.docx
# Then index
python src/web/query_product_design.py --index
```
### "Collection not found"
```bash
# Run indexing first
python src/web/query_product_design.py --index
```
### Slow queries
- First query: 10-30 seconds (cold start)
- Subsequent queries: 3-10 seconds (warm container)
## Performance Benchmarks
| Operation | Expected Time |
|-----------|--------------|
| Indexing (first time) | 2-5 minutes |
| Query (cold start) | 10-30 seconds |
| Query (warm) | 3-10 seconds |
| Web app startup | < 5 seconds |
## File Format Tests
### Should Work
- β
`.docx` files (Word)
- β
`.pdf` files (PDF)
- β
`.xlsx` files (Excel 2007+)
- β
`.xls` files (Excel 97-2003)
### Should Be Ignored
- β `.md` files (markdown)
- β `.txt` files
- β `.csv` files
- β Other formats
## Integration Tests
### End-to-End Test
1. Upload Word/PDF/Excel document
2. Index documents
3. Query via CLI
4. Query via web interface
5. Verify answers are consistent
### Error Handling Test
1. Query without indexing β Should show helpful error
2. Query with invalid question β Should handle gracefully
3. Network issues β Should show timeout/connection error
## Continuous Testing
For development, run tests after:
- Code changes
- Dependency updates
- Configuration changes
- Document updates
|