diff --git a/RESTful-API.md b/RESTful-API.md index c7e6973..2e7a647 100644 --- a/RESTful-API.md +++ b/RESTful-API.md @@ -1170,6 +1170,74 @@ NOTE: The request body is validated against a schema and must not exceed 10MB in NOTE: Authentication is required via API key. The authenticated user's role is used as the creator of the test run. +### GET /api/courses/:course_id/assignments/:assignment_id/groups/:id/test_results + +- description: Get automated test results for the given group for the given assignment. Supports two response formats: + 1. **Default**: Returns only the latest test run, grouped by test group name. Matches the UI download format. + 2. **Metadata Format** (with `include_metadata=true`): Returns all test runs with full metadata and timing information. +- optional parameters: + - `include_metadata` (boolean): Set to `true` to return full test run history. Defaults to `false`. +- supported content types: `application/json`, `application/xml` +- example response (default format, json): + +```json +{ + "Test Group 1": [ + { + "name": "Test Group 1", + "test_groups_id": 7, + "group_name": "group1", + "test_result_name": "test_addition", + "status": "pass", + "marks_earned": 3.0, + "marks_total": 5.0, + "output": "All test cases passed", + "extra_info": null, + "error_type": null + } + ] +} +``` + +- example response (metadata format with `include_metadata=true`, json): + +```json +[ + { + "id": 42, + "status": "complete", + "created_at": "2025-12-03T11:38:59.569-05:00", + "problems": null, + "test_groups": [ + { + "name": "Test Group 1", + "marks_earned": 5.0, + "marks_total": 10.0, + "time": 1250, + "tests": [ + { + "name": "test_addition", + "status": "pass", + "marks_earned": 3.0, + "marks_total": 5.0, + "output": "All test cases passed", + "time": 125 + } + ] + } + ] + } +] +``` + +NOTE: The default format is consistent with the assignment test results download available through the UI. + +NOTE: The metadata format returns all test runs ordered by creation date (newest first) and includes timing data. + +NOTE: Both formats support XML responses by setting the `Accept` header to `application/xml`. + +NOTE: Returns 404 if the group has no test results. + ### POST /api/courses/:course_id/assignments/:assignment_id/groups/:group_id/extension - description: Create an extension for the given group for the given assignment