-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Welcome to the ruby-autograder wiki!
Assuming you have Prairielearn up and running locally (if not see Installing PL locally (even if you aren't making Faded Parsons Problems)), the following steps will allow autograding for simple ruby problems:
- In your
info.json
of the question, include the following:
"gradingMethod": "External",
"externalGradingOptions": {
"enabled": true,
"image" : "saasbook/pl-fpp-ruby-autograder",
"entrypoint": "/grader/run.py",
"timeout" : 60
}
- In the
tests/
directory in your question, create a file calledmeta.json
that includes the following
{
"submission_file": "file/to/submit/to.rb",
"submission_root": "location/to/submit/additional/files/",
"submit_to_line" : 3,
"pre-text" : "any lines to precede\n the student's submission\n",
"post-text": "any lines to succeed\n the student's submission\n",
"grading_exclusions" : [
"Any test names that should not be included in grading"
]
}
-
In the
tests/
directory in your question, include the complete application that the student submits to intests/app/
. Note: do not include the text included inmeta.json
's"pre-text"
and"post-text"
fields as those will be inserted during grading. -
Also in the
tests/
directory, include the instructor's solution (excluding the"pre-text"
and"post-text"
fields) in a file namedsolution
(with no file extension). -
If you are not using the Faded Parsons Element, include a python script called
submission_processing.py
intests/
(tests/submission_processing.py
) with a functionget_submission(data: Dict) -> str
. This function takes in the entire submission data object and should return the student's submission as plaintext. You can see a simple example in the tests in this repository.
- The autograder writes the content in
data['submitted_answers"]["student-parsons-solution"]
along with the pre-text and post-text provided inmeta.json
to the submission_file inmeta.json
at the line provided inmeta.json
to the application intests/app
. - Then RSpec is run on the application and the test results are gathered.
- If there is an issue running RSpec, the output of
rspec --format json
is printed to the console hosting PL and the autograder exits without grading the submission.
- If there is an issue running RSpec, the output of
- All excluded tests are removed and the assertions below are run. If any fail, the autograder exits with an error.
- The solution provided passes all non-excluded tests
- If all assertions pass, the score is calculated as the number of tests the student passed. and feedback is their passing/failing status along with any stack traces if it was an unexpected error when running.