Spaces:
Paused
Testing Guide π§ͺ
Complete guide to test all features of the Graph RAG Chatbot.
Prerequisites
- Application running (local or Docker)
- Groq API Key configured
- Test documents prepared
Test Documents
1. Sample CSV (test_data.csv)
Create this file for testing:
Name,Role,Department,Salary
Alice Johnson,Senior Engineer,Engineering,120000
Bob Smith,Product Manager,Product,110000
Carol White,Designer,Design,100000
David Lee,Engineer,Engineering,95000
Emma Davis,Analyst,Data,90000
Save as: test_data.csv
2. Sample PDF
Use any PDF document about:
- Technology
- Business
- Science
- General knowledge
Recommended: Download a sample PDF from https://www.w3.org/WAI/test-evaluate/
3. Sample TXT
Create sample.txt with text like:
Natural Language Processing (NLP) is a subfield of linguistics,
computer science, and artificial intelligence concerned with the
interactions between computers and human language.
Machine learning is a method of data analysis that automates analytical
model building. It is a branch of artificial intelligence based on the
idea that systems can learn from data.
Graph databases are specialized databases designed to store and retrieve
relational data. They are particularly useful for managing large,
interconnected datasets where relationships are as important as the data itself.
Save as: sample.txt
Test Cases
Test 1: Upload Single Document
Objective: Verify basic file upload functionality
Steps:
- Navigate to "π€ Upload Documents" section
- Click on upload zone or drag
test_data.csv - Observe the file appears in "Uploaded Documents"
- Status should change: queued β processing β ready
Expected Results:
- β File appears immediately
- β Progress bar fills to 100%
- β Status changes to "ready"
- β Shows chunk count (e.g., "~1 chunks")
- β Shows entity count (e.g., "~12 entities")
- β "View Full Graph" link appears
Time: ~3-5 seconds
Test 2: Upload Multiple Documents
Objective: Test concurrent document processing
Steps:
- Prepare 3 test files:
test_data.csv,sample.txt, and a PDF - Click upload zone
- Select all 3 files at once
- Hold Ctrl/Cmd and select all files
Expected Results:
- β All 3 files queued simultaneously
- β Each processes independently
- β UI remains responsive
- β All reach "ready" status
Time: ~10-15 seconds total
Test 3: View Knowledge Graph
Objective: Verify graph visualization
Steps:
- Ensure a document has "ready" status
- Click "π View Full Graph" link
- Switch to "Knowledge Graph" tab
- Select document from dropdown
Expected Results:
- β Image loads without errors
- β Graph shows nodes (blue = chunks, green = entities)
- β Edges show relationships
- β Layout is readable and clear
Image Properties:
- Resolution: 150 DPI
- Format: PNG
- Size: 800x600px (approximately)
Test 4: Simple Query
Objective: Test RAG functionality with CSV data
Steps:
- Upload
test_data.csv - Wait for "ready" status
- In chat section:
- Select document from dropdown
- Type query: "Who is the senior engineer?"
- Click "Send"
Expected Results:
- β Chat message appears
- β Loading indicator shows
- β Bot responds with answer
- β Response references Alice Johnson
- β Response appears in 2-5 seconds
Example Expected Answer:
Based on the provided data, Alice Johnson is the Senior Engineer
in the Engineering Department with a salary of $120,000.
Test 5: Knowledge-based Query
Objective: Test with text document
Steps:
- Upload
sample.txt(NLP/ML content) - Wait for "ready" status
- Query: "What is machine learning?"
Expected Results:
- β Bot provides accurate explanation
- β Answer comes from the document context
- β Response is relevant and coherent
Example Expected Answer:
Machine learning is a method of data analysis that automates
analytical model building. It is a branch of artificial
intelligence based on the idea that systems can learn from data.
Test 6: Multi-chunk Context
Objective: Test queries that require context from multiple chunks
Steps:
- Upload
sample.txt - Query: "What are the relationships between NLP, machine learning, and graph databases?"
Expected Results:
- β Answer synthesizes information across multiple chunks
- β Shows understanding of relationships
- β Confidence score is shown
Test 7: Out-of-context Query
Objective: Test handling of irrelevant queries
Steps:
- Upload
test_data.csv(employee data) - Query: "What is quantum physics?"
Expected Results:
- β Bot responds: "No relevant information found in the document"
- β No incorrect information is generated
- β Error is handled gracefully
Test 8: Document Deletion
Objective: Verify document removal
Steps:
- Upload
test_data.csv - Wait for "ready" status
- Click "Delete" button
- Confirm deletion
Expected Results:
- β Document disappears from list
- β Graph image is removed
- β Cannot query deleted document
- β Dropdown option removed
Test 9: Error Handling - Invalid File
Objective: Test upload of unsupported format
Steps:
- Try to upload file with unsupported extension (.exe, .jpg, etc.)
- Observe UI response
Expected Results:
- β File is accepted (upload endpoint)
- β Processing fails with meaningful error
- β Status shows "error"
- β Error message visible: "Unsupported file type"
Test 10: Error Handling - Large File
Objective: Test max file size limit
Steps:
- Create a file > 50MB
- Try to upload
Expected Results:
- β Upload is rejected
- β Error message: "File too large"
- β File not added to list
Test 11: UI Responsiveness
Objective: Verify UI doesn't freeze during processing
Steps:
- Upload a large PDF
- While processing, try:
- Typing in chat box β Should work
- Clicking buttons β Should respond
- Switching tabs β Should work smoothly
- Scrolling document list β Should scroll
Expected Results:
- β All interactions responsive
- β No UI freezing
- β Processing continues in background
Test 12: Document List Auto-refresh
Objective: Verify real-time status updates
Steps:
- Upload document
- Watch the status bar update
- Monitor without manual refresh
Expected Results:
- β Status updates every 1.5 seconds
- β Progress bar moves smoothly
- β No manual refresh needed
- β Final status appears automatically
Test 13: Browser Compatibility
Test on: Chrome, Firefox, Safari, Edge
Steps for each browser:
- Load application homepage
- Test file upload
- Test chat functionality
- Check graph visualization
Expected Results:
- β UI loads correctly
- β All features work
- β No console errors
- β Styling renders properly
Test 14: Mobile Responsiveness
Steps:
- Open on mobile device (or DevTools)
- Set viewport to 375Γ667 (iPhone)
- Test all features:
- Upload
- Chat
- Graph viewing
- Navigation
Expected Results:
- β Layout adapts to mobile
- β Single column layout
- β Touch interactions work
- β Text is readable
Test 15: API Endpoints Directly
Tool: curl, Postman, or Python requests
Upload Request
curl -X POST \
-F "files=@test_data.csv" \
http://localhost:7860/api/upload
Expected Response:
{
"success": true,
"message": "β
1 file(s) queued for processing",
"successful": 1,
"failed": 0,
"files": ["test_data.csv"]
}
Get Documents
curl http://localhost:7860/api/documents
Expected Response:
{
"documents": {
"test_data.csv": {
"status": "ready",
"chunks": 1,
"entities": 10,
"graph_image": "/graph-image/test_data.csv"
}
},
"api_key_set": true,
"timestamp": "2024-01-15T10:30:00"
}
Query
curl -X POST \
-H "Content-Type: application/json" \
-d '{"query": "Who is the senior engineer?", "document": "test_data.csv"}' \
http://localhost:7860/api/query
Expected Response:
{
"answer": "Based on the data, Alice Johnson is the Senior Engineer...",
"sources": ["Chunk 1"],
"confidence": 0.85
}
Performance Benchmarks
Expected Processing Times
| Document Type | Size | Processing Time |
|---|---|---|
| CSV (5 rows) | ~1KB | 2-3s |
| Small TXT | ~5KB | 3-5s |
| Medium PDF | 20 pages | 10-15s |
| Large PDF | 50+ pages | 30-60s |
Query Response Times
- Simple query (1-2 words): 1-2s
- Complex query (5+ words): 2-4s
- Graph visualization load: <100ms
Load Testing
Single User
- 10 queries: Should complete in ~20-30s
- 5 uploads: Should complete in ~30-45s
Concurrent Users (Docker)
- 3 simultaneous uploads: Should handle smoothly
- 5 concurrent queries: Should not block
Checklist Summary
- Single document upload works
- Multiple document upload works
- Document shows processing status
- Graph visualization loads
- Simple query works
- Multi-context query works
- Out-of-context query handled
- Document deletion works
- Error messages appear for errors
- UI remains responsive
- Status updates automatically
- Works in multiple browsers
- Mobile responsive layout
- API endpoints work
- Performance acceptable
Debugging Tips
Check Logs
# Docker
docker-compose logs -f
# Local
python app.py # Watch console output
Common Issues
Issue: Graph doesn't load
- Check:
data/graph_data/folder exists - Check: Matplotlib installed
- Check: file permissions
Issue: Chat unresponsive
- Check: GROQ_API_KEY set
- Check: Document status is "ready"
- Check: Network connectivity
Issue: Slow processing
- Check: File size
- Check: System RAM/CPU
- Check: Model download complete
Issue: Files disappear
- Note: HF Spaces ephemeral storage
- Solution: Use persistent storage option
Test Report Template
Test Run Date: ____
Tester Name: ____
Environment: (Local/Docker/HF Spaces)
OS: ____
Browser: ____
PASS/FAIL | Test Case | Notes
---|---|---
| Test 1 |
| Test 2 |
| Test 3 |
...
Issues Found:
1.
2.
3.
Overall Result: PASS/FAIL
Happy Testing! π
If you find issues, report them with:
- Steps to reproduce
- Expected vs actual behavior
- Browser/OS information
- Relevant logs