Scenario: Send valid telemetry data to API
Steps:
- Open Postman
- Send POST to
/telemetrywith valid JSON:{ "device_id": "PV_001", "timestamp": "2024-01-01T10:00:00Z", "seq_no": 1, "temp_c": 25.0, "voltage_v": 12.5 } - Check response
Expected Result:
- Status: 200 OK
- Response:
{"result": "ok"} - No alerts generated (temp < 80°C)
Actual Result: [TO BE FILLED DURING TESTING]
Scenario: High temperature should generate alert
Steps:
- Send POST to
/telemetrywith high temperature:{ "device_id": "PV_002", "timestamp": "2024-01-01T11:00:00Z", "seq_no": 2, "temp_c": 85.0 } - Check immediate response
- GET
/alerts/device/PV_002to verify alert stored
Expected Result:
- Status: 200 OK
- Alert created with temp > 80°C
- Alert visible in alerts endpoint
Scenario: API should reject invalid data types
Steps:
- Send POST with string instead of number:
{ "device_id": "PV_003", "temp_c": "hot" }
Expected Result:
- Status: 422 Validation Error
- Clear error message about data type
Scenario: API should reject incomplete data
Steps:
- Send POST without required field:
{ "temp_c": 25.0 }
Expected Result:
- Status: 422 Validation Error
- Error about missing device_id
Scenario: Test exact alert threshold
Test Data:
- temp_c: 79.9 (should NOT alert)
- temp_c: 80.0 (should alert)
- temp_c: 80.1 (should alert)
Scenario: Test system under load Steps:
- Send batch with 100+ telemetry items
- Verify all processed correctly
- Check response time < 2 seconds
Test Data:
- device_id: "PV-001_test"
- device_id: "PV@001"
- device_id: "PV 001"
Scenario: Full end-to-end workflow Steps:
- Start API server
- Start device simulator
- Let run for 2 minutes
- Verify data appears in telemetry_db
- Check if any alerts generated
Scenario: Test store-and-forward mechanism Steps:
- Start simulator
- Stop API server (simulate network down)
- Wait 30 seconds
- Restart API server
- Verify buffered data is sent via batch endpoint
Scenario: API should respond quickly
Acceptance Criteria: < 100ms for single telemetry
Scenario: Multiple devices sending simultaneously Steps: Send 10 requests in parallel, verify all processed
Test Data: Try malicious device_id values
Test Data: Send very large JSON (>1MB)
Pre-conditions:
- API server running on localhost:8000
- Postman collection imported
- Test data prepared
Post-conditions:
- All test results documented
- Bugs reported in tracking system
- Test environment cleaned up