pdf / TESTING_PLAN.md
fokan's picture
Upload 35 files
86fce4f verified

Testing Plan for FastAPI DOCX to PDF Converter

Manual Testing Steps

1. Docker Deployment Test

  • Build and run the Docker container: docker-compose up --build
  • Verify the container starts without errors
  • Check that port 8000 is exposed and accessible

2. Web Interface Test

  • Open browser and navigate to http://localhost:8000
  • Verify the HTML interface loads correctly
  • Check that all UI elements are displayed properly
  • Test drag-and-drop functionality
  • Test file browse button

3. API Endpoints Test

  • Access Swagger documentation at http://localhost:8000/docs
  • Verify all endpoints are documented
  • Test health endpoint at http://localhost:8000/health
  • Test root endpoint returns HTML interface

4. Conversion Test

  • Prepare a test DOCX file
  • Upload the file through the web interface
  • Click convert and wait for processing
  • Verify conversion completes successfully
  • Download the converted PDF
  • Verify the PDF opens correctly

5. Error Handling Test

  • Try uploading a non-DOCX file
  • Verify appropriate error message is shown
  • Try uploading a corrupted DOCX file
  • Verify error handling works correctly

Automated Testing

1. Run test script

python test_fastapi.py

2. Test with curl

# Test health endpoint
curl -X GET "http://localhost:8000/health" -H "accept: application/json"

# Test docs endpoint
curl -X GET "http://localhost:8000/docs" -H "accept: text/html"

Expected Results

Success Criteria

  • Docker container builds and runs without errors
  • Web interface is accessible and functional
  • API endpoints respond correctly
  • DOCX to PDF conversion works for valid files
  • Error handling works for invalid files
  • PDF output maintains formatting (when possible)
  • All tests in test_fastapi.py pass

Performance Metrics

  • Conversion time for small documents: < 10 seconds
  • Conversion time for large documents: < 30 seconds
  • Memory usage: < 500MB during conversion
  • CPU usage: < 80% during conversion

Troubleshooting

Common Issues

  1. Port already in use: Stop other services using port 8000
  2. LibreOffice not found: Verify LibreOffice installation in container
  3. Font issues: Check font installation and configuration
  4. Permission errors: Verify file permissions in container

Debug Commands

# Check running containers
docker ps

# View container logs
docker-compose logs

# Enter container for debugging
docker-compose exec docx-to-pdf-arabic bash