# Backend Testing Guide ## 1. Start Backend Server ```bash cd atomizer-dashboard/backend python -m uvicorn api.main:app --reload --port 8000 ``` ## 2. Test REST Endpoints ### Get Study Status ```bash curl http://localhost:8000/api/optimization/studies/bracket_stiffness_optimization_V3/status ``` ### Get Pareto Front ```bash curl http://localhost:8000/api/optimization/studies/bracket_stiffness_optimization_V3/pareto-front ``` ### Get Trial History ```bash curl http://localhost:8000/api/optimization/studies/bracket_stiffness_optimization_V3/trials ``` ### Generate HTML Report ```bash curl -X POST "http://localhost:8000/api/optimization/studies/bracket_stiffness_optimization_V3/generate-report?format=html" ``` ### List Studies ```bash curl http://localhost:8000/api/optimization/studies ``` ## 3. Test WebSocket (Browser Console) Open browser to `http://localhost:8000` and run in console: ```javascript const ws = new WebSocket('ws://localhost:8000/api/ws/optimization/bracket_stiffness_optimization_V3'); ws.onmessage = (event) => { const data = JSON.parse(event.data); console.log('Received:', data); }; ws.onopen = () => console.log('Connected to optimization stream'); ws.onerror = (error) => console.error('WebSocket error:', error); ``` You should see a `connected` message with current trial count. ## 4. Test Mesh Conversion (If Nastran Files Available) ```bash curl -X POST http://localhost:8000/api/optimization/studies/bracket_stiffness_optimization_V3/convert-mesh ``` ## 5. Download Generated Report After generating report, download it: ```bash curl http://localhost:8000/api/optimization/studies/bracket_stiffness_optimization_V3/reports/optimization_report.html -o test_report.html ``` ## Expected Results - **Status endpoint**: Should return study config, trial counts, best values - **Pareto front**: Should return 48 Pareto-optimal solutions - **Trials endpoint**: Should return all 100 trial records - **Report generation**: Should create HTML file in `studies/bracket_stiffness_optimization_V3/2_results/reports/` - **WebSocket**: Should show connected message with current_trials = 100