Skip to content

Commit 8f8981d

Browse files
NaragodNaragod
andauthored
ISSUE-7298: Add add_test_results endpoint documentation (#247)
Co-authored-by: Naragod <m123cnb@hotmail.com>
1 parent 1120f64 commit 8f8981d

File tree

1 file changed

+112
-0
lines changed

1 file changed

+112
-0
lines changed

RESTful-API.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,6 +1058,118 @@ NOTE: collect_current value meanings:
10581058
- true: collect most recent files submitted, regardless of assignment due date or late period.
10591059
- false: collect most recent files submitted before the due date, including any late period.
10601060

1061+
### POST /api/courses/:course_id/assignments/:assignment_id/groups/:group_id/add_test_results
1062+
1063+
- description: Submit automated test results for the given group for the given assignment. This endpoint is used by the autotesting service to report test execution results.
1064+
- required parameters:
1065+
- test_results (object)
1066+
- status (string: test execution status, e.g., "pass", "fail", "finished")
1067+
- error (string or null: error message if test execution failed)
1068+
- test_groups (array of objects)
1069+
- time (integer or null: execution time in milliseconds)
1070+
- tests (array of objects)
1071+
- name (string: test name)
1072+
- status (string: one of "pass", "partial", "fail", "error", "error_all")
1073+
- marks_earned (integer: points earned)
1074+
- marks_total (integer: maximum points)
1075+
- output (string: test output/feedback)
1076+
- time (integer or null: execution time in milliseconds)
1077+
- extra_info (object)
1078+
- name (string: test group name)
1079+
- test_group_id (integer: ID of the test group)
1080+
- display_output (integer: 0=instructors, 1=instructors_and_student_tests, 2=instructors_and_students)
1081+
- criterion (string or null: associated criterion name)
1082+
- optional parameters (within test_groups):
1083+
- timeout (integer: timeout value if test timed out)
1084+
- stderr (string: standard error output)
1085+
- malformed (string: malformed output information)
1086+
- annotations (array of objects: code annotations to add)
1087+
- content (string: annotation content)
1088+
- filename (string: file to annotate)
1089+
- type (string: "TextAnnotation", "ImageAnnotation", etc.)
1090+
- line_start, line_end, column_start, column_end (integers: for text annotations)
1091+
- x1, x2, y1, y2 (integers: for image/PDF annotations)
1092+
- feedback (array of objects: feedback files to attach)
1093+
- filename (string)
1094+
- mime_type (string)
1095+
- content (string: file content, may be base64 encoded)
1096+
- compression (string: "gzip" if content is compressed)
1097+
- tags (array of objects: tags to apply to the grouping)
1098+
- name (string: tag name)
1099+
- description (string: tag description)
1100+
- overall_comment (string: overall comment to add to the result)
1101+
- example request body (json):
1102+
1103+
```json
1104+
{
1105+
"test_results": {
1106+
"status": "finished",
1107+
"error": null,
1108+
"test_groups": [
1109+
{
1110+
"time": 1250,
1111+
"extra_info": {
1112+
"name": "Correctness Tests",
1113+
"test_group_id": 42,
1114+
"display_output": 2,
1115+
"criterion": "Correctness"
1116+
},
1117+
"tests": [
1118+
{
1119+
"name": "test_addition",
1120+
"status": "pass",
1121+
"marks_earned": 2,
1122+
"marks_total": 2,
1123+
"time": 125,
1124+
"output": "All test cases passed"
1125+
},
1126+
{
1127+
"name": "test_subtraction",
1128+
"status": "fail",
1129+
"marks_earned": 0,
1130+
"marks_total": 2,
1131+
"time": 98,
1132+
"output": "Expected 5, got 3"
1133+
}
1134+
],
1135+
"annotations": [
1136+
{
1137+
"content": "Consider edge cases for negative numbers",
1138+
"filename": "calculator.py",
1139+
"line_start": 10,
1140+
"line_end": 12,
1141+
"column_start": 0,
1142+
"column_end": 20
1143+
}
1144+
],
1145+
"tags": [
1146+
{
1147+
"name": "needs_review",
1148+
"description": "Requires manual review"
1149+
}
1150+
],
1151+
"overall_comment": "Good attempt, but edge cases need work"
1152+
}
1153+
]
1154+
}
1155+
}
1156+
```
1157+
1158+
- example success response (json):
1159+
1160+
```json
1161+
{
1162+
"status": "success",
1163+
"test_run_id": 1234
1164+
}
1165+
```
1166+
1167+
NOTE: This endpoint creates a TestRun record with associated test results, annotations, feedback files, and tags. All operations are performed atomically within a transaction.
1168+
1169+
NOTE: The request body is validated against a schema and must not exceed 10MB in size.
1170+
1171+
NOTE: Authentication is required via API key. The authenticated user's role is used as the creator of the test run.
1172+
10611173
### POST /api/courses/:course_id/assignments/:assignment_id/groups/:group_id/extension
10621174

10631175
- description: Create an extension for the given group for the given assignment

0 commit comments

Comments
 (0)