Skip to content

Commit

Permalink
Add max_score to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JHawk0224 committed Feb 13, 2024
1 parent 5ac373d commit 35cb736
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion example-autograder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ To setup the autograder, follow the following steps:
Note that these commands should be identical to the ones that the students would run to start/use their submissions, so make sure to instruct them that their submissions must run with these commands. The `sample-submission` directory should exactly match the file structure of what a student submits, except with the addition of the pre and post test scripts (and the renaming of `tests.json` to `default-tests.json`) (and any other extra files your example submission might need).
7. Finally, put your default test cases in `default-tests.json`, if you have any. For a description of the format and fields of these tests, please see the README of the parent (root) directory. The only difference is that these tests have the extra optional field of `score` (see the example file). If this is specified, it's the score a student receives for passing the test on gradescope.
7. Finally, put your default test cases in `default-tests.json`, if you have any. For a description of the format and fields of these tests, please see the README of the parent (root) directory. The only difference is that these tests have the extra optional field of `score` (see the example file). If this is specified, it's the score a student receives for passing the test on gradescope. There's also an extra optional `max_score` field. If this is specified, the Gradescope test case's max score is set to this value, but otherwise it's just the value of `score` if specified (otherwise 0) (e.g. to give students 3 out of 0 for an extra credit test, set `score` to 3 and `max_score` to 0).
8. Now we can configure other scoring options. Other than setting scores for each default test, you can also set a total combined score for passing all of the default tests (this would be on top of any score specified for each test in the `score` field). To do this, use the `groupedDefaultTestsScore` config variable. Additionally, you can set a score given to any student who successfully submits the required number of tests to the database (at least `numPublicTestsForAccess` tests submitted `timeToDeadline` hours before the assignment deadline). This value can be configured in the `submitTestsScore` field of the config.
Expand Down
2 changes: 1 addition & 1 deletion example-autograder/test-grader/grader.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ def main():
"name": result["name"],
"status": "failed" if not result["result"]["success"] else "passed",
"score": result["test"]["score"] if result["test"].get("isDefault", False) and "score" in result["test"] and result["result"]["success"] else 0,
"max_score": result["test"]["score"] if result["test"].get("isDefault", False) and "score" in result["test"] else 0,
"max_score": result["test"]["max_score"] if result["test"].get("isDefault", False) and "max_score" in result["test"] else (result["test"]["score"] if result["test"].get("isDefault", False) and "score" in result["test"] else 0),
"output": "Description: " + result["test"]["description"] + "\n\n" + result["result"]["reason"] if "description" in result["test"] and result["test"]["description"] else result["result"]["reason"],
"visibility": "visible",
"test-data": {
Expand Down
2 changes: 1 addition & 1 deletion testit-server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ app.get('/get-tests/:assignmentName', authenticateToken, (req, res) => {
}));

if (!userIsAdmin) {
items = items.map(({ test, studentsRan, studentsRanSuccessfully, studentsLiked, studentsDisliked, public, visibility, isDefault, score, ...rest }) => rest);
items = items.map(({ test, studentsRan, studentsRanSuccessfully, studentsLiked, studentsDisliked, public, visibility, isDefault, score, max_score, ...rest }) => rest);
}

res.status(200).json(items);
Expand Down

0 comments on commit 35cb736

Please sign in to comment.